I have something like this:
$scope.last_good_configuration = $scope.storage;
In $scope.last_good_configuration I keep last good settings.
And when user type in input bad value, for example too big integer i want to do:
$scope.storage = $scope.last_good_configuration;
But my $scope.last_good_configuration is all the time the same as $scope.storage. How to stop updating $scope.last_good_configuration? I have to evaluate my scope somehow?
You need to make a copy or clone of the original object. Angular has a built in method for this: angular.copy.
$scope.last_good_configuration = angular.copy($scope.storage);
//Edits must be at least 6 characters workaround
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments