为什么这个 jsfiddle不能正常工作?我无法获取videoId
的值。如果我从模块中删除ngRoute
,则它可以正常工作。
你需要像这样使用ng-src
:
<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');
});
angular-route.min.js
的链接显示“404 Not Found”。 - EpokK