Ng model not updating

For the sake of the example, I just logged the new and old values to the console; however you could perform other functionality, such as instigating a remote service call or other processing.

When an element in the controller changes the view is updated automatically.When an input in the view is updated, the controller value is automatically updated.Our controller code (on first attempt) would look something like this: Writing it out, this way looks a bit cleaner to me as well.A Plunker demo of these concepts in action: This is one of those nasty issues I wish someone would have pointed out to me from the start.The second is a function which is executed whenever the value changes.

The arguments for the change function are the new Value and the old Value.Try this and you'll see that the values in the UI are not updated even though you can see the log in the console, proving that the element did execute.As a helper, you can add a method to log the user information: Click the log Name button, and you'll see that the values in the UI automatically get updated.You'll need to keep the web developer console of your browser open to see the log statements.For binding, or the $watch() method, to execute the variable change must happen within the context of an Angular JS $digest().During your first foray into Angular you will probably not come across this as it is one of those hidden, quasi-leaky-abstraction sort of things that only becomes well known to you as you work on getting a non-trivial app off the ground.