You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Description
If you have an input box that is associated with a model that is an array (or an object), the update machinery ($formatter pipeline and so on) is not triggered if only a property on the array or object changes. This is because ngModelController watches the model without checking objectEquality.
The multiple select input has a kind of hack that triggers a call to $render if the model updates a property but this fails to call the $formatter pipeline. If we push a new option into the array then the select renders OK but a required validator would fail to update.
Suggested Fix
Asking the NgModelController to watch with object equality would probably be the simplest solution. There may be a performance impact, though since most models are not objects or arrays then this should short-circuit quite quickly for those values.
Narretz
changed the title
fix(ngModelController): trigger change when only property of model changes
ngModelController: trigger change when only property of model changes
Dec 10, 2014
Description
If you have an input box that is associated with a model that is an array (or an object), the update machinery ($formatter pipeline and so on) is not triggered if only a property on the array or object changes. This is because ngModelController watches the model without checking objectEquality.
The multiple
select
input has a kind of hack that triggers a call to $render if the model updates a property but this fails to call the $formatter pipeline. If we push a new option into the array then the select renders OK but arequired
validator would fail to update.Reproduction
See this http://plnkr.co/edit/yNFihkAgrVhHYx7lOtMc?p=preview.
Suggested Fix
Asking the
NgModelController
to watch with object equality would probably be the simplest solution. There may be a performance impact, though since most models are not objects or arrays then this should short-circuit quite quickly for those values.Angular Version: 1.2.5+
OS: all
Related to : #5337
The text was updated successfully, but these errors were encountered: