Closed patriknil90 closed 7 years ago
I have the same issue
Here is a workaround
extend the Idle Class and provide it instead of Idle
eg
import { Optional, Injectable } from '@angular/core';
import { Idle, SimpleExpiry } from 'ng2-idle/core';
@Injectable()
export class PalIdle extends Idle {
constructor(expiry: SimpleExpiry) {
super(expiry);
}
}
then in your component, module whatever: providers: [PalIdle, SimpleExpiry]
Thanks @elvirdolic ,this worked great for me as well!
@patriknil90 I'm using Ionic RC0, i'm trying to use the workaround form @elvirdolic, but I keep getting an error:
node_modules/ng2-idle/core.js does not export SimpleExpiry
It works fine using ionic serve, but when I try and make a prod bundle (ionic build ios) it fails as above - I assume its the AOT compiler that is complaining for some reason.
Can you provide a working repo with the workaround in it?
My code snippet: import { Idle} from 'ng2-idle/core'; import { SimpleExpiry} from 'ng2-idle/core';
@Injectable() export class PalIdle extends Idle { constructor(expiry: SimpleExpiry) { super(expiry); } }
@Component({ templateUrl: 'app.html', providers: [PalIdle, SimpleExpiry], }) export class MyApp { ...
Had ng2-idle implemented on a RC5/Webpack installation after following the GETTING STARTED part of the readme. Everything working fine. Upgraded to RC6 yesterday and got an error + app crash.
Image with the chrome console error
I have not tried to install the ng2-keepalive library in my app.
What I did try was to declare the KeepaliveSvc class as a provider in app.module.ts and in the component where the Idle functions run in different ways with no success.
Setup:
app.module.ts:
auth-timer.component.ts: