restore values saved only when Save is clicked

This commit is contained in:
Matteo Pagliazzi
2013-10-13 19:58:13 +02:00
parent c3086c6194
commit 4e56df0e82
2 changed files with 18 additions and 10 deletions

View File

@@ -59,9 +59,17 @@ habitrpg.controller('SettingsCtrl',
});
}
$scope.restoreValues = {};
$rootScope.$watch('modals.restore', function(value){
if(value === true){
$scope.restoreValues.stats = angular.copy(User.user.stats);
$scope.restoreValues.items = angular.copy(User.user.items);
}
})
$scope.restore = function(){
var stats = User.user.stats,
items = User.user.items;
var stats = $scope.restoreValues.stats,
items = $scope.restoreValues.items;
User.setMultiple({
"stats.hp": stats.hp,
"stats.exp": stats.exp,