AngularJS ng-model-optionsညွှန်ကြားချက်


ဥပမာ

အကွက်ကို အာရုံမစိုက်မချင်း data-binding ဖြင့် စောင့်ပါ-

<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-optionsHTML ဖောင်ဒြပ်စင်နှင့် နယ်ပယ်အတွင်းရှိ ကိန်းရှင်တစ်ခု၏ ပေါင်းစပ်မှုကို ထိန်းချုပ်ရန် အသုံးပြုသည်။

စည်းနှောင်မှုသည် တိကျသောဖြစ်ရပ်တစ်ခုဖြစ်ပေါ်ရန် စောင့်သင့်သည်ဟု သတ်မှတ်နိုင်သည်၊ သို့မဟုတ် တိကျသောမီလီစက္ကန့်အရေအတွက်ကို စောင့်ဆိုင်းရမည်ဖြစ်ပြီး၊ အောက်ဖော်ပြပါ ကန့်သတ်ဘောင်တန်ဖိုးများတွင် ဖော်ပြထားသော တရားဝင်တန်ဖိုးများကို ကြည့်ပါ။


အထားအသို

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

<input>၊ <select> နှင့် <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.