簡體   English   中英

輸入為空時 ng-show 顯示錯誤

[英]ng-show show error when input is empty

好吧,我有 :

<div class="form-group">
<label for="address" class="control-label col-lg-5 col-md-6">                                @Html.Label(@Translator.Translate("STREET_ADDRESS")):
<span ng-show="editUserForm.Address.$error.required" class="required">*</span>
</label>
<div class="col-lg-7 col-md-6">
@Html.TextBoxFor(m => m.Address, new {name="Address", @class = "form-control", id = "address", @maxlength = "30", ng_model = "address", @required = "required", ng_pattern = @"/[A-Za-z]+ ?[0-9]+$/" })
</div>
</div>

所以我的想法是當這個文本框為空時顯示 * 但對我來說它不起作用......有幫助嗎?

(移自評論)將跨度更改為:

<span ng-show="!address">*</span>

嘗試這個

   <span ng-show="editUserForm.Address.$dirty && editUserForm.Address.$error.required" class="required">*</span>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM