アイテムのリストがあり、アイテムの1つをクリックすると、ユーザーが変更を加えて「閉じる」または「変更を保存」をクリックするためのモーダルダイアログが表示されます。
問題は、ユーザーがいくつかの変更を加えて「閉じる」をクリックすると、データバインディングが即座に行われるため、ビューがバインドされているモデルに変更が反映されることです。
私の質問は、更新を延期して「変更を保存」をクリックしたときにのみバインディングを実行する方法、または「キャンセル」をクリックした場合に変更を忘れる方法です。
私のモーダル ダイアログのコードは次のようになります。
<div ui-modal class="fade static" ng-model="modalShown" id="myModal" data-backdrop="static">
<div class="modal-header">
<button type="button" class="close" ng-click="closeModal()" aria-hidden="true">×</button>
<h3>{{selectedClientFeature.feature.type}}</h3>
</div>
<div class="modal-body">
<ul class="unstyled columnlist">
<li ng-repeat="country in countriesForEdit">
<input type="checkbox" ng-model="country.selected"> {{country.name}}
</li>
</ul>
</div>
<div class="modal-footer">
<a ng-click="closeModal()" class="btn">Close</a>
<a ng-click="saveChanges()" class="btn btn-primary">Save changes</a>
</div>
</div>
ありがとう、ショーン