Prev Demo
AngularJS
>
Validate Values
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head> <body> <style> .ng-valid{ background-color:green; color:white; } .ng-invalid{ background-color:red; color:black; } .ng-pristine{ background-color:#9c914c; } </style> <div ng-app> <h4>Valid values</h4> <p>String: <input type="text" ng-model="txtValue" required /> | {{ txtValue }}</p> <p>Email: <input type="email" ng-model="emailValue" required /> | {{ emailValue }}</p> <p>Number: <input type="number" ng-model="numberValue" required /> | {{ numberValue }}</p> <p>Date: <input type="date" ng-model="dateValue" required /> | {{ dateValue }}</p> <p>URL: <input type="url" ng-model="urlValue" required /> | {{ urlValue }}</p> </div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output