Closed bankly closed 8 years ago
eg:
<ul ng-repeat="employee in arrange.employees track by $index"> <li ng-model="employee.employeeName" **required** > <div ng-if="employee.headimgurl==null"> <img ng-src="images/employee_user.png" > </div> <div ng-if="employee.headimgurl!=null"> <img ng-src="{{employee.headimgurl}}" > </div> </li> </ul>
非表单元素都没有输入,为啥需要验证,在界面显示之前就应该验证好了的, 你这 li 标签上加 ng-model 有啥意义,哪里可以修改 employee.employeeName,如果要做就设置一个隐藏的元素做验证
通过这个元素的valid属性判断是否验证通过,然后显示错误的样式即可
eg: