首先是我的HTML代码:
<form name="Form" novalidate>
<div class="form-group has-error has-feedback">
<input class="form-control" type="text" name="Name" ng-model="item.name" required="" aria-describedby="" />
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
<span class="sr-only">(error)</span>
<br />
<div class="has-error has-feedback" ng-show="Form.$submitted || Form.Name.$touched">
<span ng-show="Form.Name.$error.required">Name is invalid.</span>
</div>
</div>
我想显示div class&#34; has-error has-feedback&#34;当名称无效时,仅限glyphicon。我怎样才能发展出来?
答案 0 :(得分:0)
如果要根据无效显示,则需要执行以下操作:
[0]
glyphicon相同:
<div class="has-error has-feedback" ng-show="Form.Name.$invalid">
<span ng-show="Form.Name.$error.required">Name is invalid.</span>
</div>