Expression value to store in localstorage


#1

Is there a way where I can store expression such as {{item.hello}} directly to a localstorage?


#2

You can try :

To set item on local storage

window.localStorage.setItem('hello', 'Just say Hi! with a smile.');

To get item from local storage

window.localStorage.getItem('hello');

If you want to use it in your html view you need to do :

In your controller (.js)

$scope.hello = window.localStorage.getItem('hello');

In your view (.html)

{{hello}}