I am new to angular 5 and Ngrx, some how i managed to implement a login functionality, once login is success i am taking the user to dashboard. But if I refresh the page the user state seems to be lost. How to make the user state persistent even the page reloads ?
相关问题
- Angular RxJS mergeMap types
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- How to update placeholder text in ng2-smart-table?
- How to instantiate Http service in main.ts manuall
- Angular: ngc or tsc?
相关文章
- angular脚手架在ie9+下兼容问题
- angular 前端项目 build 报错 "Cannot find module 'le
- Cannot find module 'redux' 怎么解决?
- Angular Material Stepper causes mat-formfield to v
- After upgrade to Angular 9 cannot find variable in
- is there any difference between import { Observabl
- Suppress “Circular dependency detected” suppress w
- How can you get current positional information abo
as @user184994 Mentioned
NGRX
state is only held in memory. If you want it to persist between page refreshes Go forLocalStorage
orsessionStorage
localStorage
andsessionStorage
accomplish the exact same thing and have the same API, but withsessionStorage
the data is persisted only until the window or tab is closed, while withlocalStorage
the data is persisted until the user manually clears the browser cache or until your web app clears the data.I would suggest you to go for @ngx-pwa/local-storage Async local storage for Angular
For Angular 5:
Register it in your RootModule
Inject and use it
Usage