Reputation: 678
I have a question regarding the angularjs set value and reset it to default.
Here an example
$scope.defaultValue = {
a: 1,
b: 2
}
var dupValue = $scope.defaultValue;
...
function changeValue() {
dupValue.b = 3;
}
...
After I execute the function changeValue()
, I wish to change my dupValue
back to defaultValue
which I simply just call
dupValue = $scope.defaultValue;
Some how it did't work. Because the defaultValue
's element has changed due to the function i executed.
Is there any method to make this work?
Upvotes: 0
Views: 484