This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
oldCollection always .equals(); never === to newCollection in $watchCollection #6041
Closed
Description
Docs for $watchCollection 's listener say:
listener a callback function that is
- fired with both the
newCollection
andoldCollection
as parameters.- The
newCollection
object is the newly modified data obtained from theobj
expression- and the
oldCollection
object is a copy of the former collection data.
In my demo (http://plnkr.co/edit/WXGn5LaoiJmLzJ8rMImQ?p=preview - open JS console) I see:
- (bug) oldCollection always .equals() newCollection - even when array is mutated or replaced altogether
- (perhaps design flaw) oldCollection !== newCollection on first invocation - unlike in $watch. IMO behavior should be consistent between the two methods and on first invocation oldCollection must be === newCollection - to be able to easily tell that it is - in fact - first invocation