当我为自定义指令放置一个嵌套的 ng-show 属性时出现错误,一个属性位于指令的标记中,第二个属性位于指令模板的根元素中。
我的真实场景很复杂,所以我将其简化为这个例子:
假设我的 my-custom-directive 下面已经包含 ng-show:
<my-custom-directive ng-show="someValue >= 5"></my-custom-directive>
然后 'my-custom-directive' 的模板如下所示:
<div ng-show="options != null">My Custom Directive</div>
那些多个 ng-show 一起导致错误。
如果我删除其中一个或将内部 ng-show 移动到其 dom 树的至少一层,则错误消失(当它的位置位于根模板元素上时会发生这种情况)。
此错误在 angular v1.4.8 上测试。
这是角虫吗?或者对这种行为有合理的解释?
这是 Plunker 示例: http ://embed.plnkr.co/ZTZVcfc5bfmjPo9t0Isw
先感谢您,
梅纳赫姆