[英]Angularjs Custom Directive Not Working in Chrome
我為emded標簽創建了一個自定義指令,以使用src。 它適用於mozilla firefox,但不適用於chrome。
app.directive('embedSrc', function () {
return {
restrict: 'A',
link: function(scope, element, attrs) {
scope.$watch(
function() {
return attrs.embedSrc;
},
function() {
element.attr('src', attrs.embedSrc);
}
);
}
};
});
請幫忙。
采用
$compile(element.contents())(scope);
和
attrs.$observe('embedSrc', function (newValue) {
newValue === "true";
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.