javascript - AngularJs form validation doesn't work -
i new on angular js, working on form validations. have done still validation doesn't work. here code:
<form role="form" name="studentform" class="form-horizontal" novalidate> <div class="form-group"> <label for="student_email" class="col-sm-2 control-label">email</label> <div class="col-sm-10"> <input type="email" name="student_email" ng-model="studentemail" class="form-control" id="student_email" required> <div role="alert" class="error-msg" ng-messages="studentform.student_email.$error"> <p ng-message="required">your email required.</p> </div> </div> </div> </form>
script:
angular.module('app', ['ngmessages']);
here working demo code.
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.js"></script> <script src="script.js"></script>
may forgot add scripts in html files. position of scripts in index.html file matters. ng-message should include below angular.min.js
please check demo
Comments
Post a Comment