EVOLUTION-MANAGER
Edit File: input[number].html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ng/directive/input.js?message=docs(input[number])%3A%20describe%20your%20change...#L570' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a> <a href='https://github.com/angular/angular.js/tree/v1.3.9/src/ng/directive/input.js#L570' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in"> </i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">input[number]</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - input in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Text input with number validation and transformation. Sets the <code>number</code> validation error if not a valid number.</p> <p>The model must always be a number, otherwise Angular will throw an error.</p> </div> <div> <h2>Directive Info</h2> <ul> <li>This directive executes at priority level 0.</li> </ul> <h2>Usage</h2> <pre><code><input type="number" ng-model="" [name=""] [min=""] [max=""] [required=""] [ng-required=""] [ng-minlength=""] [ng-maxlength=""] [pattern=""] [ng-pattern=""] [ng-change=""]></code></pre> <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> ngModel </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Assignable angular expression to data-bind to.</p> </td> </tr> <tr> <td> name <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Property name of the form under which the control is published.</p> </td> </tr> <tr> <td> min <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Sets the <code>min</code> validation error key if the value entered is less than <code>min</code>.</p> </td> </tr> <tr> <td> max <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Sets the <code>max</code> validation error key if the value entered is greater than <code>max</code>.</p> </td> </tr> <tr> <td> required <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Sets <code>required</code> validation error key if the value is not entered.</p> </td> </tr> <tr> <td> ngRequired <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Adds <code>required</code> attribute and <code>required</code> validation constraint to the element when the ngRequired expression evaluates to true. Use <code>ngRequired</code> instead of <code>required</code> when you want to data-bind to the <code>required</code> attribute.</p> </td> </tr> <tr> <td> ngMinlength <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-number">number</a> </td> <td> <p>Sets <code>minlength</code> validation error key if the value is shorter than minlength.</p> </td> </tr> <tr> <td> ngMaxlength <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-number">number</a> </td> <td> <p>Sets <code>maxlength</code> validation error key if the value is longer than maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any length.</p> </td> </tr> <tr> <td> pattern <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Similar to <code>ngPattern</code> except that the attribute value is the actual string that contains the regular expression body that will be converted to a regular expression as in the ngPattern directive.</p> </td> </tr> <tr> <td> ngPattern <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Sets <code>pattern</code> validation error key if the ngModel value does not match a RegExp found by evaluating the Angular expression given in the attribute value. If the expression evaluates to a RegExp object then this is used directly. If the expression is a string then it will be converted to a RegExp after wrapping it in <code>^</code> and <code>$</code> characters. For instance, <code>"abc"</code> will be converted to <code>new RegExp('^abc$')</code>.</p> </td> </tr> <tr> <td> ngChange <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Angular expression to be executed when input changes due to user interaction with the input element.</p> </td> </tr> </tbody> </table> </section> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-number-input-directive')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-number-input-directive" name="number-input-directive" module="numberExample"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><script> angular.module('numberExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.value = 12; }]); </script> <form name="myForm" ng-controller="ExampleController"> Number: <input type="number" name="input" ng-model="value" min="0" max="99" required> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.number"> Not valid number!</span> <tt>value = {{value}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form></code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>var value = element(by.binding('value')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('value')); it('should initialize to model', function() { expect(value.getText()).toContain('12'); expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { input.clear(); input.sendKeys(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('false'); }); it('should be invalid if over max', function() { input.clear(); input.sendKeys('123'); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('false'); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-number-input-directive/index.html" name="example-number-input-directive"></iframe> </div> </div> </p> </div>