我有一个自定义指令,如下所示。您能告诉我如何从中过滤超链接元素吗?换句话说,如何识别元素是超链接?提前谢谢。
app.directive('toggler', function ($document) {
return {
link: function (scope, element, attrs, ctrl) {
scope.open = false;
element.on('click', function (e) {
scope.$apply(function () {
scope.open = true; //onclick open tooltip and call digest so the ng-if see the change
});
e.stopPropagation(); //stop event from bubbling up to document object
});
}
}
});