This is a follow-up to @Emmanuel's answer above to @Martin Velez's answer, although I know it's quite late! (Also, I can not comment, so if this is not a suitable place for this, sorry!)
I'm not sure which version of Angular OP was used, but in Angular # 1.2 +, at least on the official docs https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$render , $ render is displayed in the following way:
Called when a view needs to be updated. The ng-model directive user is expected to implement this method.
The $ render () method is called in the following situations:
Called$ rollbackViewValue (). If we roll back the view to the last committed value, $ render () is called to update the input control. The value referenced by the ng model changes programmatically, and both $ modelValue and $ viewValue are different from the last time. Since the ng model does not make deep observations, $ render () is only called if the values of $ modelValue and $ viewValue are actually different from their previous value.
I interpret this as meaning that the correct $ way to look at ngModel from a directive is to require ngModel and implement a communication function that introduces ngModelController. Then use the ngModel API, which is built into $ render-on-change ($ watch) or something else.
RoboBear May 13 '15 at 16:54 2015-05-13 16:54
source share