Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(input): ngList is updated when array model values are changed #5689

Closed

Conversation

gonzaloruizdevilla
Copy link
Contributor

fixes #1751

Depends on PR #5688
Split of PR #3865

When the model referenced the same same array and the array values
where changed, the list wasn't updated.
Now watchCollection is used to detect changes in NgModelController.

Changes in input.js breaked tests:
— select select-multiple should require
— select ngOptions ngRequired should treat an empty array as invalid when multiple attribute used

Changes in select.js fixed them again: changes in the collections should trigger the formatters and render again.

BEHAVIOUR CHANGE
There is a change in the behaviour of ngList when typing a list.
When “a , b” is typed is automatically changed to “a, b”.

Gonzalo Ruiz de Villa added 2 commits January 8, 2014 00:01
…he former array data

related to angular#1751
When watching arrays, $watchCollection returned the new data both in the newCollection
and the oldCollection arguments of the listener
fixes angular#1751

When the model referenced the same same array and the array values
where changed, the list wasn't updated.
Now watchCollection is used to detect changes in NgModelController.

Changes in input.js breaked tests:
— select select-multiple should require
— select ngOptions ngRequired should treat an empty array as invalid when `multiple` attribute used

Changes in select.js fixed them again: changes in the collections should trigger the formatters and render again.

BEHAVIOUR CHANGE
There is a change in the behaviour of ngList when typing a list.
When “a , b” is typed is automatically changed to “a, b”.
@tbosch
Copy link
Contributor

tbosch commented Jan 9, 2014

I think the first commit is wrong. It should be about the change for ng-options, right?

@Narretz
Copy link
Contributor

Narretz commented Sep 13, 2015

#12783 is a new attempt to fix this. It also shows why we can't simply use $watchCollection watch

@Narretz Narretz closed this Sep 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ngModel + ngList binding to array does not update view when model changes
6 participants