I am trying to display videos in iframe, but nothing gets displayed even though I am getting the right embed link for it. I have tried testing it by just displaying the link and the correct link gets displayed, and when I am hardcoding the same link for the iframe, videos gets displayed, but nothing gets rendered in the iframe when I am having it like this:
<ion-item ng-repeat="article in articles" class="item-light">
<img ng-show="article.external_media.length == 0 || article.external_media.url == ''" src="http://coop.app/imagecache/cover/{{article.cover_image}}">
<iframe ng-show="article.external_media.length > 0 && article.external_media.url != ''" src="{{article.external_media[0].url}}"></iframe>
</ion-item>
Update
Since I need to inject $sce dependency I wonder how to apply it to all the possible links in my controller. How would that function look?
This is my controller:
.controller('FrontPageController', function($scope, ArticleService, $state) {
ArticleService.all().then(function(data){
$scope.articles = data;
})
I'd recommend a filter for this.
in your html
I advocate filters over controller methods only in I like to keep my controllers very lightweight. If something needs to be interpreted, I use a filter.