1

i'm trying to accomplish something really nice (and really strange).

I've got an angular controller calling (with $http.get, passing arguments got from angular) a php script which gets some data from the database and decide to echo one out of two possible html templates.

The problem is, in those templates there are expressions which should be parsed by angular. They don't.

Here are the scripts:

the first angular controller:

    $http.get("../php/jwtCheck.php?token=" + localStorage.token + "&courseid=" + $stateParams.id).success(function (response) { 

       $scope.phpData = $sce.trustAsHtml(response);

    });

the receiving php script:

//doing mysql stuff
if (sqlStuff::isBought($row[bought], $stuffID)){
                include '../boughtTemplate.html';
            } else
            {
                include "../previewTemplate.html";
            }

inside the templates i have this call to angular $scope:

<video data-html5-video="{{generateVideoFolder($index)}}" data-controls="true" data-preload="false" data-width="400" data-height="224">
</video>

which never got parsed by angular.

Any idea?

Tiziano Coroneo
  • 640
  • 6
  • 18

1 Answers1

1

You need to compile phpData.

Here is one approach I stole from another SO question: https://stackoverflow.com/a/29994559/3563439

See the solution applied to your case in my Fiddle: http://jsfiddle.net/masa671/zfftw7qr/

Community
  • 1
  • 1
masa
  • 2,762
  • 3
  • 21
  • 32