Pawan Parashar
Pawan Parashar

Reputation: 50

ng-model not providing the changed value

I have change the value input of my dom element using jquery code in materialize js plugin :

 $input.val($(this).attr('id').trim());

I am not getting the ng-model value in my controller, but getting value in POST form.

I need the implicit value on input value change.

How can I achieve this.

Please advice using the code.

Upvotes: 1

Views: 46

Answers (1)

Atul Sharma
Atul Sharma

Reputation: 10740

Just run

$scope.$apply();

after changing the value... to start the $digest cycle.

After changing the value outside of angular scope you need to bring the changes to angular...

Upvotes: 2

Related Questions