আমি ব্যবহার করে ngRepeat
এবং ব্যবহার করে আইটেমের একটি তালিকা সম্পাদনা করার জন্য ব্যবহারকারীকে অনুমতি দেওয়ার চেষ্টা করছি ngModel
। ( এই ধাঁধাটি দেখুন ।) তবে, উভয় পদ্ধতির জন্য আমি উদ্ভট আচরণের দিকে এগিয়ে যাওয়ার চেষ্টা করেছি: একটি মডেল আপডেট করে না, এবং অন্যটি প্রতিটি কী-ডাউনটিতে ফর্মটি ঝাপসা করে।
আমি কি এখানে কিছু ভুল করছি? এটি কি সমর্থিত ব্যবহারের মামলা নয়?
সুবিধার্থে অনুলিপিযুক্ত ফিডল থেকে কোডটি এখানে:
<html ng-app>
<head>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body ng-init="names = ['Sam', 'Harry', 'Sally']">
<h1>Fun with Fields and ngModel</h1>
<p>names: {{names}}</p>
<h3>Binding to each element directly:</h3>
<div ng-repeat="name in names">
Value: {{name}}
<input ng-model="name">
</div>
<p class="muted">The binding does not appear to be working: the value in the model is not changed.</p>
<h3>Indexing into the array:</h3>
<div ng-repeat="name in names">
Value: {{names[$index]}}
<input ng-model="names[$index]">
</div>
<p class="muted">Type one character, and the input field loses focus. However, the binding appears to be working correctly.</p>
</body>
</html>