Hi everyone, I've just run into a problem when developing a custom directive using the ngModel Controller.
I'm adding a custom function to the $viewChangeListeners list so I get notified whenever the value changes, and everything was working fine until I manually changed the value of the ngModel bound property from a controller. I've noticed in that case that my function subscribed on $viewChangeListeners list was not being called. I've checked the code and, as the value was changed from my controller, the directive was reacting to that change inside the ngModelWatch function, which calls all the formatters registered for that property, but doesn't notify any of the listeners. First I changed my directive to add a new formatter to the controller, returning the same value as received, and everything was working fine, but I refuse to go this way as my directive is not formatting anything. Then I decided to modify the ngModelWatch function to loop over the registered listeners on the $viewChangeListeners to notify each one. Of course, that fixed my problem. My intention is to develop some tests and implement this change inside the input.js to submit a pull request after that but, I guess there must be some obvious reason I'm missing why the ngModelWatch function is not notifying ngModel subscribers. Can someone please explain me if it makes sense to add this behaviour to the ngModel directive? If not, why the ngModelWatch function is not notifying ngModel subscriber that a change has been made to that model?. Thanks a lot for your help. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.