Daniel Stradowski Daniel Stradowski - 7 months ago 245
TypeScript Question

Access HTML5 local storage from Angular2

I'm following this tutorial: https://medium.com/@blacksonic86/authentication-in-angular-2-958052c64492 about authentication in Angular2.

I've the issue with this part:

import localStorage from 'localStorage';

I've read somewhere else that I should use this library https://github.com/marcj/angular2-localstorage to access local storage in HTML5. Is it really the only option? Can I access HTML5 local storage from angular2 without using extra modules?


You can use localStorage directly in your service without import localStorage from 'localStorage';.