0
我正在嘗試使用Angular 1.x監視窗體的更改。我正在這樣做,這樣如果用戶在保存數據之前離開頁面,我可以顯示警告。我能夠$觀看形式。$ valid就好,但形式。$髒只是永遠不會開火。所以要清楚,這個工程:
$scope.$watch('forms.editForm.$valid', function (newVal, oldVal) {
// This is how we tell if there are unsaved form changes so we don't navigate away
$scope.unsavedFormChanges = oldVal;
}, true);
這並不:
$scope.$watch('forms.editForm.$dirty', function (newVal, oldVal) {
// This is how we tell if there are unsaved form changes so we don't navigate away
$scope.unsavedFormChanges = oldVal;
}, true);
誰能請賜教,爲什麼我不能看$ $髒,如果有這樣做的備份計劃? - 謝謝