/form-on-change

AngularJS ng-change like functionality for the entire form

Primary LanguageJavaScript

AngularJS ng-change like functionality for the entire form

Use Case: When given a form - we would like to call a method for every change in one of the forms fields.
For example: Update the server for each change in one of our fields.

the form-on-change directive support elements, <textarea> boxes and elements. by listening to the 'change' event so according to JQuery documentation: The change event is sent to an element when its value changes. This event is limited to input elements, textarea boxes and select elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus. Install bower install form-on-change Usage Add form-on-change.js to list of scripts: <script src="bower_components/form-on-change/form-on-change.js"></script> Add module dependency angular.module('your-app-name', ['chenop.form-on-change']); In your HTML it should look something like that: <form name="form1" form-on-change="doSomething()"> <input ng-model="formData.a"> <input ng-model="formData.b"> </form>