好的,我有:
<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>
所以我的想法是当这个文本框显示为空时显示*但对我来说它不起作用......有什么帮助吗?
答案 0 :(得分:2)
(从评论中移动)将范围更改为:
<span ng-show="!address">*</span>
答案 1 :(得分:0)
试试这个
<span ng-show="editUserForm.Address.$dirty && editUserForm.Address.$error.required" class="required">*</span>