jsonを特定のキーで更新するにはどうすればよいですか? 私の場合、フィードバックを「応答しない」から「応答しました」に更新したいと考えています。 AngularJS:特定のキーでモーダルでJSONを更新
<div class="parent" ng-repeat="customer in customers">
<h2>{{customer.id}}</h2>
<p>{{customer.question}}</p>
<h4 ng-show="{{customer.is_answered}}">Answered</h4>
<h4 ng-show="!{{customer.is_answered}}">Not Answered</h4>
<button ng-show="!{{customer.is_answered}}" ng-click="showModal()">Reply</button>
</div>
私は返信ボタンをクリックし
が、その後、応答に私の顧客の苦情をいくつか入力してモーダルを表示されます。[
{
"id": "34",
"mac_address": "cd:9e:17:64:1b:42",
"question": "Help me",
"time": "2016-03-16 16:22:08",
"is_answered": false
}
]
[
{
"id": "34",
"mac_address": "cd:9e:17:64:1b:42",
"question": "Help me",
"time": "2016-03-16 16:25:29",
"is_answered": true
}
]
にいくつかのリスト私の顧客のフィードバックがあります。
<div id="modal">
<textarea placeholder=""response></textarea>
<button ng-click="submit()">Reply</button>
</div>
私はフィードバックIDに基づいて更新したいと思います。また、どのようにそれを行うのがベストプラクティスですか?
君たちに感謝私たちはあなたのコントローラのコードを見ることができますか? – JordanHendrix
個人的に私はlodash findIndexを使ってidでアイテムを取り出し、更新を実行します - https://lodash.com/docs#findIndex – dmoo
私は最近このリンクを見つけました:[link](http://stackoverflow.com/questions/ 30917576/angularjs-open-modal-with-specific-data-from-array)、類似のトピック – artemist