moribvndvs / ng2-idle

Responding to idle users in Angular (not AngularJS) applications.
https://moribvndvs.github.io/ng2-idle
Apache License 2.0
315 stars 128 forks source link

ngModule and WebPack #23

Closed briebug closed 7 years ago

briebug commented 7 years ago

Using the latest version of ng2-Idle, I am not able to get it to work with the full release of Angular 2. I keep getting errors around No Provider for KeepAliveSrv.

To reproduce (using angular-cli):

ng new idleTest

npm install --save ng2-idle

There is no module exposed to add to app.module.ts, so I have to resort to adding IDLE_PROVIDERS to the providers section.

fernandohlee commented 7 years ago

Hi I'm running the angular 2 (~2.0.1) version and the ng2-idle (1.0.0-alpha.16) with webpack, I've applied the workaround refer to @iherbivore answer on (https://github.com/HackedByChinese/ng2-idle/issues/22), however in my case I just added to providers SimpleExpiry and the PalIdle class, like so:

providers: [ PalIdle, SimpleExpiry ],

hope that helps