gsklee / ngStorage

localStorage and sessionStorage done right for AngularJS.
MIT License
2.33k stars 461 forks source link

Reset storage variables to default values #160

Open artemjackson opened 9 years ago

artemjackson commented 9 years ago

It would be great to have ability to reset ngStorage variables to their default values

egilkh commented 9 years ago

Hey!

Could you provide an example use case?

// Setup
$scope.$storage = $localStorage.$default({
    counter: 42
});

$scope.$storage.counter = 142;

$scope.$storage.$reset();
// Now the counter is 42 again.

Something like this you would like ?

artemjackson commented 9 years ago

yep, exactly it could be $resetDefaults() method or something like this

Firzenizer commented 6 years ago

This would have been exactly, what I needed.