@ng-idle does not work with Angular 8
Closed this issue · 1 comments
vamcs commented
Describe the bug
No observable is ever triggered, and the extension simply can't be used.
To Reproduce
Create an Angular 8 project and implement the example project.
In app.module.ts
I provided the service with NgIdleModule.forRoot()
in the imports array. And this is the constructor of app.component.ts
:
constructor(private idle: Idle) {
this.idle.setIdle(5);
this.idle.setTimeout(5);
this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);
this.idle.onIdleStart.subscribe(() => console.log('Gone idle'));
this.idle.onIdleEnd.subscribe(() => console.log('Idle no more'));
this.idle.onTimeoutWarning.subscribe((countdown: number) =>
console.log(
`You'll be logged out in ${countdown} seconds because of inactivity.`
)
);
this.idle.onTimeout.subscribe(() => console.log('Timeout'));
}
Expected behavior
The extension would work at all.
Please tell us about your environment
- Mobile or Desktop: Desktop
- Browser: Chrome or Firefox (latest stable)
- Version: 8.0.0-beta.4
- Angular version: 8.2.5
- NodeJS version: 10.16.3
- Language (TypeScript x.x, ES5, ES2015, etc.): TypeScript 3.5.3
vamcs commented
Of course, the problem was simple. I forgot to call idle.watch()
to tell the extension to start running.