English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myCtrl"> <p>Update the input box:</p>/p> <input ng-model="name" ng-model-options="{updateOn: 'blur'}"> <p>Bind the input box value to the scope variable when losing focus:</p>/p> {{name}} </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.name = "John Doe"; }); </script> <p>This example demonstrates how to use ng-model-The options directive binds the value of the input box to the scope variable when it loses focus.</p> </body> </html>Test to see ‹/›
ng-model-options The directive binds HTML form elements to the scope variable
You can specify the time when the bound data is triggered, or specify how many milliseconds to wait, the parameter settings can be referred to in the following instructions.
<element ng-model-options="option"></element>
The <input>, <select>, <textarea> elements support this directive.
Value | Description |
---|---|
option | Specify the rules for binding data, as follows: {updateOn: 'event}'Rule specifies binding data after the event occurs {debounce : 1000} Specify how many milliseconds to wait before binding data {allowInvalid : true|false} Specify whether to bind data after validation {getterSetter : true|false} Specify whether to be treated as getters/setters binding to model {timezone : '0100 Whether to use the time zone when rules are used |