I know this is a long time, but please carry me. The problem is easy to understand, it just takes writing to fully explain it.
I am getting this error now
Error: [$interpolate:noconcat] Error while interpolating: Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce
I read everything in the documentation, but I still cannot find a workaround for my problem.
I use $ http.get in a private online source that has data similar to the json file form (so I cannot modify the data). The data is as follows:
... "items": [ { "kind": "youtube#searchResult", "etag": "\"N5Eg36Gl054SUNiWWc-Su3t5O-k/A7os41NAa_66TUu-1I-VxH70Rp0\"", "id": { "kind": "youtube#video", "videoID": "MEoSax3BEms" }, }, { "kind": "youtube#searchResult", "etag": "\"N5Eg36Gl054SUNiWWc-Su3t5O-k/VsH9AmnQecyYBLJrl1g3dhewrQo\"", "id": { "kind": "youtube#video", "videoID": "oUBqFlRjVXU" }, }, ...
I am trying to interpolate the videoId of each element in my HTML iframe, which includes a YouTube video. In my controller.js file, I set the promise object after $ http.get as such
$http.get('privatesource').success(function(data) { $scope.videoList = data.items; });
So, now the variable $ scope.videoList is mapped to data.items, which has a lot of video elements. In my HTML file, I can get the video id of each video using
<ul class="videos"> <li ng-repeat="video in videoList"> <span>{{video.id.videoID}}</span> </li> </ul>
and it lists all the video IDs. But if I try to associate these values ββwith a url like https://youtube.com/embed/ , this will not work.
<div ng-repeat="video in videoList"> <iframe id="ytplayer" type="text/html" width="640" height="360" ng-src="https://www.youtube.com/embed/{{video.id.videoId}}" frameborder="0" allowfullscreen></iframe> </div>
Is there a way I can get the videoID to interpolate to youtube url? I tried using the whitelist using $ sceDelegateProvider as follows, but it still does not work.
$sceDelegateProvider.resourceUrlWhitelist([ 'self', 'https://www.youtube.com/**']);
Any help is appreciated. Thank!