Angularjs 包含嵌套指令的角度窗体未验证
我有一个非常简化的html,如下所示:Angularjs 包含嵌套指令的角度窗体未验证,angularjs,angularjs-directive,Angularjs,Angularjs Directive,我有一个非常简化的html,如下所示: <call-panel> <form name="hotListForm" > <twilio> <input type="text" name="phoneOtherText" id="phoneOtherText" class="form-control" required="required" ng-model="phoneNumber" ng-pattern=
<call-panel>
<form name="hotListForm" >
<twilio>
<input type="text" name="phoneOtherText" id="phoneOtherText" class="form-control" required="required" ng-model="phoneNumber" ng-pattern="validation" ng-trim="false"/>
<span class="error" ng-show="hotListForm.phoneOtherText.$error.pattern">Not a valid phone number</span>
</twilio>
</form>
</call-panel>
不是有效的电话号码
但这不起作用。在嵌套指令中,是否有特殊的方法来执行此操作。我已经验证了模式是否可用
它的形式和形式结构截图:
它不起作用可能是因为您的id也设置为“phoneOtherText”,请尝试更改id并尝试我尝试将id重命名为phoneOther,但它不起作用。然后我尝试将“name”重命名为phoneOther,并将id更改为phoneOtherText,但仍然保持不变。我找到了答案$parent.hotListForm.phoneOtherText.$error.pattern已修复此问题您应该删除此问题,因为标题具有误导性。这是一个简单而诚实的错误。与嵌套指令无关。当人们搜索时,他们发现了这个,但里面没有什么有用的东西。