Nijeesh
Nijeesh

Reputation: 77

Ng-Idle issue with multiple tabs

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.

Upvotes: 0

Views: 3308

Answers (2)

Austin Wasinger
Austin Wasinger

Reputation: 119

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.

Upvotes: 2

tanmay
tanmay

Reputation: 7911

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.

Upvotes: 2

Related Questions