AngularJS ng-model
ညွှန်ကြားချက်
ဥပမာ
input အကွက်တစ်ခု၏တန်ဖိုးကို နယ်ပယ်အတွင်းရှိ variable တစ်ခုနှင့် ချိတ်ပါ-
<div ng-app="myApp" ng-controller="myCtrl">
<input ng-model="name">
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name
= "John Doe";
});
</script>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
လမ်းညွှန်ချက် သည် ng-model
HTML ဖောင်ဒြပ်အား နယ်ပယ်အတွင်းရှိ ကိန်းရှင်တစ်ခုသို့ ချိတ်ဆက်ပေးသည်။
Scope တွင် variable မပါပါက၊ ၎င်းကို ဖန်တီးမည်ဖြစ်သည်။
အထားအသို
<element ng-model="name"></element>
<input>၊ <select> နှင့် <textarea> ဒြပ်စင်များဖြင့် ပံ့ပိုးထားသည်။
ကန့်သတ်တန်ဖိုးများ
Value | Description |
---|---|
name | The name of the property you want to bind to the form field. |
ဆက်စပ်စာမျက်နှာများ
Angular Tutorial- မော်ဒယ်လမ်းညွှန်