firstly html code:
<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 invalid.</span> </div> </div>
i want show div class "has-error has-feedback" , glyphicon only, when name invalid. how can develop this?
if want display according being invalid, need this:
<div class="has-error has-feedback" ng-show="form.name.$invalid"> <span ng-show="form.name.$error.required">name invalid.</span> </div>
same glyphicon:
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true" ng-show="form.name.$invalid"></span>
Comments
Post a Comment