0
這裏添加範圍不工作href是我的html:Angularjs:當我的指令
<a href="#modal{{screencast.id}}" role="button" class=" btn" data-toggle="modal"
ng-click="fetch_comments(screencast.id)" ng-video url="match_url(screencast.video_url)">Play</a>
我的指令:
'use strict';
App.directive('ngVideo', [function() {
return {
restrict: 'A',
scope: { url: '='},
link: function (scope, elem, attrs) {
elem.bind('click', function() {
console.log(scope.url);
});
}
}
}]);
當我刷新頁面href="#modal{{screencast.id}}"
我只有href="#modal"
。當我從指令中刪除scope: { url: '='}
時,它工作正常,並且href
的值爲screencast.id
。 我做錯了什麼?
感謝晏,它爲我工作。 –