I'm using $http.get on https://www.googleapis.com/youtube/v3/search?part=snippet&q=test&key='MY_API_KEY' to get a list a videos from YouTube.
The link has the video ID that I want to concatenate as follows: "https://youtube.com/embed/{{videoID}}" but in order to get the videoID, I have to use
<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>
But Angular does not allow interpolations that concatenate multiple expressions. The console error is
Error: [$interpolate:noconcat] Error while interpolating: https://www.youtube.com/embed/{{video.id.videoId}}
Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required.
I've read the $sce documentation and I've tried whitelisting https://www.youtube.com/**
Here is a jsfiddle to show my relevant code: http://jsfiddle.net/xzdk3/ The display result doesn't show most likely because the api key requires me to allow IP addresses to access it.
I'm not sure what to do at this point. I could make a function to create new array to contain the full links (www.youtube.com/embed/{videolinkhere}) and ng-repeat through that, but there must be another way. I tried thinking of a way to rename video.id.videoID to a single expression so that angular can interpolate it, but I don't know how to do that using ng-repeat's syntax of
ng-repeat="video in videoList"
I can't just do
ng-repeat="video.id.videoId in videoList"
Any help is appreciated.