Tuesday, January 30, 2018

How to write a program for validation of forms in angularJS.

  • AngularJS offers client-side form validation.
  • AngularJS monitors the state of the form and input fields (input, textarea, select), and lets you notify the user about the current state.
  • AngularJS also holds information about whether they have been touched, or modified, or not.
  • You can use standard HTML5 attributes to validate input, or you can make your own validation functions.


Program
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
</head>
<body ng-app="">
<p>
Type  an Email address in  the input fields
</p>
<form name="myForm">
<input type="email" name="myInput" ng-model="myInput">
</form>
<p >
{{myForm.myInput.$valid}}
</p>
</body>
</html>

Output




0 comments:

Post a Comment

Thanks For Commented.

TechTalk