我写了一个带隔离范围的指令.
原文链接:https://www.f2er.com/angularjs/141042.htmlapp.directive('myDirective',function() { return { restrict: 'E',scope { attr1: '@',attr2: '@',noValueAttr: // what to put here? },link: function(scope,elem,attrs) { // how to check here if noValueAttr is present in mark-up? } }; });
HTML可能是
<my-directive attr1='...' attr='...' ... no-value-attr>
要么
<my-directive attr1='...' attr='...' >
我想知道如何使用(并使指令检测它是否存在)一个没有赋值的可选属性.谢谢.