Home
Tutorials
Microsoft Technologies Tutorials
Java Programming Tutorials
Web Designing Tutorials
Script Programming Tutorials
Database Programming Tutorials
Mobile Technologies Tutorials
Other Programming Tutorials
Examples
Articles
Tools
News
AngularJS Input Fields Validation with Class Example
Keywords : Angularjs input fields validation example, Angularjs validate input controls with css classes example, Angularjs ng-valid ng-invalid classes to validate input controls example
Example
<!DOCTYPE html> <html> <head> <title> AngularJs Applying classes for Input Fields Validation </title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <style> input.ng-invalid { background-color:#f2672e; } input.ng-valid { background-color:#2b8bc0; } </style> </head> <body> <div ng-app=""> <h2>AngularJS Input Field Validations with Class Example</h2> <form name="personForm"> <br /> First Name:<input type="text" name="firstname" ng-model="person.fname" required /> <br /><br /> Last Name:<input type="text" name="lastname" ng-model="person.lname" required /> <br /><br /> </form> </div> </body> </html>
Click Here to See Result
Result
Previous
Next