Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJs with iframe

Why this jsfiddle is not working? I am not able to get value of videoId. If I remove ngRoute from module then it is working fine.

like image 683
ARV Avatar asked Dec 06 '25 21:12

ARV


1 Answers

You need to use ng-src like this:

<div ng-controller="AppController">
    <h1>{{videoID}}</h1>
    <iframe class="youtube-player" type="text/html" width="auto"
    height="auto" ng-src="{{videoID}}"
    allowfullscreen="" frameborder="0"> </iframe>
</div>

and

var app = angular.module('my-app', []);
app.controller('AppController', function ($scope, $sce) {  
    $scope.videoID = $sce.trustAsResourceUrl('http://www.youtube.com/embed/C0DPdy98e4c');
});

See this documentation.

like image 62
EpokK Avatar answered Dec 09 '25 11:12

EpokK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!