Using angular.copy instead of angular.extend for deep copies.