Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorial</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> </head> <body> <form ng-app="myApp" name="Form" ng-controller="NumberCtrl"> <h3>input[number] directive example</h3> Enter the Number: <input type="number" name="input" ng-model="value" min="0" max="99" required> <span ng-show="Form.input.$error.required">Required!</span> <span ng-show="Form.input.$error.number">Not valid number!</span> <p>value = {{value}}</p> <p>Form.input.$valid = {{Form.input.$valid}}</p> <p>Form.input.$error = {{Form.input.$error}}</p> <p>Form.$valid = {{Form.$valid}}</p> <p>Form.$error.required = {{!!Form.$error.required}}</p> </form> <script> var app=angular.module('myApp', []); app.controller('NumberCtrl', ['$scope', function($scope) { }]); </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.