Reputation: 315
In the Auth0
quickstart for Angular2, the code accesses local storage via the following example:
localStorage.setItem('id_token', authResult.idToken);
localStorage
resolves to type Storage
.
I don't see where this is defined in the example but it does work. Can anyone tell me why this works?
Upvotes: 0
Views: 453
Reputation: 71931
localStorage
is a default property on the window
object. And Storage
is a standard JavaScript
object, so no import is necessary.:
https://developer.mozilla.org/en/docs/Web/API/Window/localStorage
This applies to IE>=8
Upvotes: 2