Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No provider for KeepaliveSvc! at NoProviderError.BaseError #24

Closed
duderdice opened this issue Nov 3, 2016 · 2 comments
Closed

Comments

@duderdice
Copy link

When using the "ng2-idle" component without the "ng2-idle-keepalive", the sample documentation on how to use causes me to get the following error when using Angular2 (currently using 2.1.x):

Error: No provider for KeepaliveSvc! at NoProviderError.BaseError [as constructor]

However, I can get around this but doing both of the following...

@NgModule({
	providers: [
        IDLE_PROVIDERS, {provide: KeepaliveSvc, useValue: undefined}, <-- insert a fake KeepaliveSvc injectable
	],

and

export class AppComponent {
    private configureIdleBehavior() {
        // this._idle.setKeepaliveEnabled(false); //must comment this out, else app wants a valid KeepaliveSvc

My fix was pieced together with the help of some other issues but wanted to report it here so the documentation on the main page can be updated accordingly to help others getting bitten by this, or to actually fix the providers in the component to work properly with the official Angular 2+ releases.

grbsk added a commit that referenced this issue Nov 4, 2016
This commit adds support for NgModule and replaces the old ng2-idle/core approach. Use
Ng2IdleModule.forRoot() in your app module imports to use the new module.

Fixes #3, #10, #22, #23, #24
@grbsk grbsk closed this as completed Nov 4, 2016
@duderdice
Copy link
Author

Wow, thanks for the quick turn around!

@duderdice
Copy link
Author

When using the new NgModule approach as follows,

import { Ng2IdleModule } from 'ng2-idle';

@NgModule({
    imports: [
        ....
        Ng2IdleModule.forRoot(),
    ]

I get the following error:

Unexpected value '[object Object]' imported by the module 'AppModule'

is there more to the story? or perhaps a fix needed against this commit for using NgModule approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants