[英]Angularjs Custom Directive Not Working in Chrome
I had created one custom directive for emded tag to use src . 我为emded标签创建了一个自定义指令,以使用src。 It is working for mozilla firefox but not working in chrome. 它适用于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);
}
);
}
};
});
Please help. 请帮忙。
Use 采用
$compile(element.contents())(scope);
and 和
attrs.$observe('embedSrc', function (newValue) {
newValue === "true";
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.