AngularJS ng-model-optionsनिर्देश


उदाहरण

डेटा-बाइंडिंग के साथ प्रतीक्षा करें जब तक कि फ़ील्ड फ़ोकस खो न दे:

<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>

परिभाषा और उपयोग

निर्देश का ng-model-optionsउपयोग HTML फॉर्म तत्व के बंधन और दायरे में एक चर को नियंत्रित करने के लिए किया जाता है।

आप निर्दिष्ट कर सकते हैं कि बाइंडिंग को किसी विशिष्ट घटना के घटित होने की प्रतीक्षा करनी चाहिए, या एक विशिष्ट संख्या में मिलीसेकंड की प्रतीक्षा करनी चाहिए, और अधिक, नीचे दिए गए पैरामीटर मानों में सूचीबद्ध कानूनी मान देखें।


वाक्य - विन्यास

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

<इनपुट>, <चयन>, और <textarea> तत्वों द्वारा समर्थित।


पैरामीटर मान

Value Description
option An object specifying what options the data-binding must follow. Legal objects are:

{updateOn: 'event'} specifies that the binding should happen when the specific event occur.

{debounce : 1000} specifies how many milliseconds to wait with the binding.

{allowInvalid : true|false} specify if the binding can happen if the value did not validate.

{getterSetter : true|false} specifies if functions bound to the model should be treated as getters/setters.

{timezone : '0100'} Specifies what timezone should be used when working with the Date object.