Sander, the main reason I am using ngModelController is to cut down 
watchers double calling. Also there is a significant amount more that 
happens to besides just $render(). I could potentially copy the whole 
$watch function (below) into a new directive controller, but I am trying 
very hard NOT to rewrite already written angular coding. Also the second 
watcher will double the over all work. 


Original $watcher code: 

> $scope.$watch(function ngModelWatch() {
>     var value = ngModelGet($scope);
>
>     // if scope model value and ngModel value are out of sync
>     if (ctrl.$modelValue !== value) {
>
>       var formatters = ctrl.$formatters,
>           idx = formatters.length;
>
>       ctrl.$modelValue = value;
>       while(idx--) {
>         value = formatters[idx](value);
>       }
>
>       if (ctrl.$viewValue !== value) {
>         ctrl.$viewValue = value;
>         ctrl.$render();
>       }
>     }
>
>     return value;
>   });
>
>

All I want to do is change the if statement in the beginning and keep all 
the rest of the controller the exact same.

-- Rhett :D


On Monday, February 10, 2014 7:04:27 PM UTC-8, Sander Elias wrote:
>
> Hi Rhett,
>
> Put a watch in your own code that does a ngModel.$render after you detect 
> a change.
> Something like: $scope.$watchCollection('myArray',ngModel.$render)
>
> That would do the trick.
>
> Regards
> Sander
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to