1
Hello, I have a youtube iframe and I have to pass to it i video ID, which is saved in the database, for this I am using an angular variable, as follows:
<iframe width="100%" height="650px" src="https://www.youtube.com/embed/{{institucional.video}}" frameborder="0" allowfullscreen></iframe>
The problem is that it gives interpolation error: This error occurs when Interpolation fails due to some Exception.
With the codes below it simply does not appear ng-src when I have element inspected
<iframe width="100%" height="650px" ng-src="{{trustSrc('https://www.youtube.com/embed/' + vm.video)}}" frameborder="0" allowfullscreen></iframe>
vm.Institucional = function () {
InstitucionalService.buscaInstitucional().then(function (response) {
if (response.data != 0) {
vm.mostraInstitucional = response.data;
vm.video = $sce.trustAsResourceUrl(response.data[0].video);
} else {
vm.mostraInstitucional = '';
}
}, function (error) {
console.error(error);
});
}
Why don’t you make it render everything in one process just...? It will work.
– Ivan Ferrer