Latest web development tutorials

AngularJS ng-model-options command

AngularJS Reference Manual AngularJS Reference Manual


Examples

Binding input box loses focus when the value of the variable in scope:

<Div ng-app = "myApp " ng-controller = "myCtrl">
<Input ng-model = "name " ng-model-options = "{updateOn: 'blur'}">
</ Div>

<Script>
var app = angular.module ( 'myApp' , []);
app.controller ( 'myCtrl', function ( $ scope) {
$ scope.name = "John Doe";
});
</ Script>

try it"

Definition and Usage

ng-model-options command to bind the HTML form elements to a variable scope

You can specify bind data to trigger time, or specify how many milliseconds to wait, parameter settings can refer to the following instructions.


grammar

<Element ng-model-options = "option"> </ element>

<Input>, <select>, <textarea>, elements support this instruction.


Parameter Value

value description
option Specifies the rules for binding data, the rules are as follows:

{updateOn: 'event'} after a specified event occurs bound data rule

{Debounce: 1000} waiting for a predetermined number of milliseconds after binding data

{AllowInvalid: true | false} The provisions need to verify whether the binding data

{GetterSetter: true | false} Specifies whether to bind to the model as getters / setters

{Timezone: '0100'} rule whether the time zone

AngularJS Reference Manual AngularJS Reference Manual