[英]angularJS - ng-show - error
這就是我所擁有的。
<form action="/asvabo/ChangeCustomerRegister.do" method="post"
name="CustomerRegisterForm">
...
<input ... type="text" ... name="order.id" pattern="[0-9]*" required
ng-model="orderid" ng-trim="true"/>
<!-- Label for show that the input is required -->
<span class="error"
ng-show="CustomerRegisterForm.order.id.$error.required">Required!
</span>
....
</form>
我認為,NAME屬性存在問題。 如果我在兩者中使用orderid,則輸入標記和以下錯誤條件都可以使用。 但我們使用Struts,我需要像xxxx.yyyy
這樣的NAME屬性
有沒有辦法在der ng-show
exprssion中使用這種語法?
感謝您的評論。
form.$addControl = function(control) {
// Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
// and not added to the scope. Now we throw an error.
assertNotHasOwnProperty(control.$name, 'input');
controls.push(control);
if (control.$name) {
form[control.$name] = control;
}
};
在你的情況下,輸入的control.$name === "order.id"
,所以這發生了什么:
form["order.id"] = control;
<span class="error"
ng-show="CustomerRegisterForm['order.id'].$error.required">Required!
</span>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.