我写了指令:
ensureUnique: function ($http, $parse) {
return {
scope: {
ensureUniqueType: "=",
ensureUniqueDisabled: "="
},
...
}
},
但如果我尝试像这样使用它:
<input name = "groupId" ng-show="anyFunction()"
type="text" ng-model="group.groupId"
ensure-unique="" ensure-unique-disabled="oldId != '-1'" ensure-unique-type="type" >
输入元素变得不可见(不依赖于 anyFunction 结果)。似乎指令范围重写了ngShow值