手记

angular form表单验证

<form name="myForm" novalidate>
<div>
用户名:<br/>
<input type="text" name="user" ng-model="user" required/>
<span style="color:red" ng-show = "myForm.user.$invalid&& myForm.user.$dirty">
<span ng-show = "myForm.user.$error.required">用户名是必选项</span>
</span>
</div>
<div>

3人推荐
随时随地看视频
慕课网APP