EVOLUTION-MANAGER
Edit File: ngChange.html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ng/directive/ngChange.js?message=docs(ngChange)%3A%20describe%20your%20change...#L3' 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/ngChange.js#L3' 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">ngChange</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - directive in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Evaluate the given expression when the user changes the input. The expression is evaluated immediately, unlike the JavaScript onchange event which only triggers at the end of a change (usually, when the user leaves the form element or presses the return key).</p> <p>The <code>ngChange</code> expression is only evaluated when a change in the input value causes a new value to be committed to the model.</p> <p>It will not be evaluated:</p> <ul> <li>if the value returned from the <code>$parsers</code> transformation pipeline has not changed</li> <li>if the input has continued to be invalid since the model will stay <code>null</code></li> <li>if the model is changed programmatically and not by a change to the input value</li> </ul> <p>Note, this directive requires <code>ngModel</code> to be present.</p> </div> <div> <h2>Directive Info</h2> <ul> <li>This directive executes at priority level 0.</li> </ul> <h2 id="usage">Usage</h2> <div class="usage"> <ul> <li>as attribute: <pre><code><input ng-change=""> ... </input></code></pre> </li> </div> <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> ngChange </td> <td> <a href="" class="label type-hint type-hint-expression">expression</a> </td> <td> <p><a href="guide/expression">Expression</a> to evaluate upon change in input value.</p> </td> </tr> </tbody> </table> </section> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-ngChange-directive')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-ngChange-directive" name="ngChange-directive" module="changeExample"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><script> angular.module('changeExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.counter = 0; $scope.change = function() { $scope.counter++; }; }]); </script> <div ng-controller="ExampleController"> <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" /> <input type="checkbox" ng-model="confirmed" id="ng-change-example2" /> <label for="ng-change-example2">Confirmed</label><br /> <tt>debug = {{confirmed}}</tt><br/> <tt>counter = {{counter}}</tt><br/> </div></code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>var counter = element(by.binding('counter')); var debug = element(by.binding('confirmed')); it('should evaluate the expression if changing from view', function() { expect(counter.getText()).toContain('0'); element(by.id('ng-change-example1')).click(); expect(counter.getText()).toContain('1'); expect(debug.getText()).toContain('true'); }); it('should not evaluate the expression if changing from model', function() { element(by.id('ng-change-example2')).click(); expect(counter.getText()).toContain('0'); expect(debug.getText()).toContain('true'); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-ngChange-directive/index.html" name="example-ngChange-directive"></iframe> </div> </div> </p> </div>