I've set up a small fiddle here http://jsfiddle.net/SPMfT/137/ and I was wondering if someone could explain me why changing an object doesn't work, while changing properties of the object, or changing the object with "$scope" in front works.
The reason is that I try to avoid using scope in controller functions so they will be easier to test.
My real task is an ng-click="reset(current, master)" with
$scope.reset = function (current, master) { angular.copy(current, master); }
This doesn't work, whereas this works:
$scope.reset = function (current, master) { angular.copy($scope.current, master); }
Both $scope.current and $scope.master exist
Cheers
Update:
My problem was I wasn't updating the object itself. To solve the problem use e.g.
angular.extend(data, { name: 'change', game:'change' });
or
angular.copy({ name: 'change', game:'change' }, data);//Pay attention to order