I\'m trying to set the src attribute of an iframe from a variable and I can\'t get it to work...
The markup:
I suspect looking at the excerpt that the function trustSrc from trustSrc(currentProject.url) is not defined in the controller.
You need to inject the $sce service in the controller and trustAsResourceUrl the url there.
In the controller:
function AppCtrl($scope, $sce) {
// ...
$scope.setProject = function (id) {
$scope.currentProject = $scope.projects[id];
$scope.currentProjectUrl = $sce.trustAsResourceUrl($scope.currentProject.url);
}
}
In the Template: