我想从“a”标签中删除 href 属性(像纯文本一样工作),并且我在指令文件中使用此代码:
.directive('rhHasLinkFor', function () {
return{
priority: 10000,
restrict: 'A',
compile: function (el, attr) {
el.href.remove();
}
}
});
但是不起作用,问题出在哪里?
最佳答案
尝试
.directive('rhHasLinkFor', function () {
return{
priority: 10000,
restrict: 'A',
compile: function (el, attr) {
el.removeAttr('href');
}
}
});
关于javascript - AngularJS 删除 href,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24504999/