I am building a TODO-lists app using Angularjs, nodejs and mongoose.
What I want to do is to trigger ajax when watched model changes.
I noticed the well known todomvc use the following code
$scope.$watch('todos', function () {
$scope.remainingCount = filterFilter(todos, {
completed: false
}).length;
$scope.doneCount = todos.length - $scope.remainingCount;
$scope.allChecked = !$scope.remainingCount;
todoStorage.put(todos);
}, true);
However I have a TODO detail panel, and I use x-editable to in-place edit the title.
The model is referenced by app.currentTodo.
Currently I use
$scope.$watch('currentTodo', function(){ $http... });
Is there a better way?