応答を見るのに問題があります。
設定として SettingsCtrl があり、これが私の見解です。
<input type="text" class="form-control" ng-model="settings.test.one" />
<input type="text" class="form-control" ng-model="settings.test.second" />
そして、これは私のコントローラーです:
app.controller('SettingsCtrl', function ($scope, settingsFactory, Test) {
var vm = this;
settingsFactory.test().then(function(response){
vm.test = response;
})
///// OR
vm.test = Test; // this is from ui-router resolve
$scope.$watch(angular.bind('vm', function () {
return vm.test;
}), function (newV, oldV) {
console.log(newV, oldV);
});
$scope.$watch(function watch(scope){
return vm.test;
}), function handle(newV, oldV) {
console.log(newV, oldV);
});
$scope.$watch('vm', function (newVal, oldVal) {
console.log('newVal, oldVal', newVal, oldVal);
});
});
私は検索してさまざまな解決策を見つけましたが、どれも機能しません。
**** コントローラーがロードされ、コンソール ログが表示されるのは初めての監視ですが、変更を加えようとするとウォッチャーは何もしません。
私が間違っていることは何ですか?