$watch is not invoked when value is changed on the form. So on the form it is updated at another place but $watch event is not invoked. Look the situation below. It should work that way.
http://jsfiddle.net/tw05z9ug/
I’ve found some mentions here http://ionicframework.com/docs/api/directive/ionNavView/. It did not help.
it may be because a lot of ionic elements are directives thus creating new child scope. Try setting holding scope value and work with it. or create a plukr with your problem and we can work it out
I’ve created a situation - http://plnkr.co/edit/zV10KvYn3ztJ3DZaYjHO?p=preview It works well. In my case it does not.
It is not helpful. Would be good if you could create an ionic plunker. Or paste exact code in here. View + controller.
https://github.com/vlikin/car_budget This is my first IONIC project.
Look at car calculator https://github.com/vlikin/car_budget/blob/master/ionic/www/js/src/lib/state/car.js
This is the view - https://github.com/vlikin/car_budget/blob/master/ionic/www/templates/car.calculator.html
So are you saying that in ‘car.calculator’ state
$scope.$watch('aaa1', function(val) {
console.log('aaa1 changed');
});
doesn’t work?
It does not work. It is a test. I also tried to intercept it on the parent controller. It worked. But once time it stoped to work. There are not any error messages in the console.
I also moved ion-nav-view to ui-view making it more transparent.
Here you go: http://plnkr.co/edit/wJNVytMKLkC0jI5jVUK7?p=preview
all you needed is a holding scope value
Yes. Thank you. It works this way.