angular/angular.js — pull request #5661 by johnsoftek (2014-01-07 12:18:45+00:00)
Title: watchCollection: Return correct oldCollection argument to listener

At present, when watchCollection calls a registered listener, the oldCollection argument has the same value as
the newCollection argument. This does not accord with the API description: "The newCollection object is the newly modified data obtained from the obj expression and the oldCollection object is a copy of the former collection data.".

This fix caches the collection value correctly. It also includes some optimisations to avoid copy activity when the collection is unchanged.