AngularJS $setViewValue() Not Responding in $parsers.push()

☆樱花仙子☆ 提交于 2019-12-06 08:09:18

$setViewValue is called from the logic method, which triggers another $parsers cycle, creating infinite recursion causing the RangeError: Maximum call stack size exceeded

ngModelController.$parsers[] affect the resulting ngModelController.$modelValue, if you also want to affect the ngModelController.$viewValue, you can set the $viewValue directly and call ngModelController.$render() to allow the component to update the DOM.

http://jsfiddle.net/GSTC5/4/

The ngModelController.$setViewValue() should only be called by the DOM change event.

This should've been a job for the ngModelController.$formatters[], but sadly the formatters aren't applied when the change is initiated by $setViewValue()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!