1
我的代码如下:Angularjs:检查是否输入是空的,NG-形式
<ng-form name="invitationForm">
<div ng-repeat="email in emails" ng-form='lineForm'>
<div class="has-feedback" ng-class="{'has-error': lineForm.$invalid && lineForm.input, 'has-success': lineForm.input && !lineForm.$invalid}">
<label class="control-label sr-only" for="inputSuccess">Input with success</label>
<input ng-change="inputCheck($index)" id="inputSuccess" placeholder="Enter your friend's email" name="input" ng-model="email.value" class="form-control input-mini" aria-describedby="inputSuccessStatus" type="email" />
</div>
</div>
</ng-form>
我想要做的就是有类格“有反馈”上课“了 - 错误”当lineForm无效并且输入不为空时。 我把条件线形$无效& & lineForm.input但lineForm.input似乎没有工作。 我也试过lineForm.input.length无济于事。
感谢
我认为你是在复杂的事情,如果你正在使用的角度1.3,通过yearofmoo的文章阅读表格和验证 - http://www.yearofmoo.com/2014/09/taming-forms-in-angularjs-1-3.html – 2014-12-04 21:48:25