angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

ngModelWatch breaks if $modelValue is object

Open serzh opened this issue 12 years ago • 1 comments

When using ngModel inside custom directive there is a chance to break ngModelWatch fn. On the first run ngModelWatch will set $modelValue to ngModelGet($scope). Then, if you change property of that scope var (ngModelGet($scope)) it will change the properties on the $modelValue, because it is the same object! So if you have some $formatters they won't be called at all.

Here is plnkr for demonstration.

serzh avatar Mar 11 '14 17:03 serzh

Duplicate of https://github.com/angular/angular.js/issues/5449

Narretz avatar Sep 11 '15 09:09 Narretz