I have an array and a watcher in my $scope
. Watcher detects changes on the array property. Watcher works as expected: triggers listener when i update array contents.
When I assign my $scope
to some other variable (var newScope = $scope
), however,
and then push an item to newScope
's array , the watcher is not called.
Javascript should assign $scope to newScope by reference right? So, $scope
and newScope
will refer to the same object in memory. Then, why watcher is not called when I modify array on newScope
?