0

If we use same application in multiple tabs, both application uses the same localstorage for storing ngIdle.expiry and one application extends the session of other one. Is there any work around to fix this issue in current version, like configure sessionstorage instead of localstorage or like change the id field in the ngIdle.expiry.

Nijeesh
  • 77
  • 1
  • 9

2 Answers2

2

In ng-idle documentation, I don't see a way to change which storage you want to use.

Hence, you can maybe keep a copy of the project in your codebase (or send a PR) with this line changed to use sessionStorage instead. It might just work how you want it to.

tanmay
  • 7,761
  • 2
  • 19
  • 38
2

I know this is old, but for other people searching this topic, yes there is a built in way to do this if you're using ng2-idle (Angular 2+).

In your app.module.ts, in the provider section you need to provide the SimpleExpiry:

@NgModule({
declarations: [ . . .],
imports: [ . . . ],
providers: [
    . . .
    {
        provide: IdleExpiry,
        useClass: SimpleExpiry
    }
]

See https://github.com/moribvndvs/ng2-idle#extensible-expiry for more information.