Coder Social home page Coder Social logo

Comments (7)

sublime392 avatar sublime392 commented on July 21, 2024 1

I got it working following an answer in another issue here.
I made an idle.hack.ts file with

import { Injectable } from '@angular/core';
import { Idle, SimpleExpiry } from 'ng2-idle/core';

@Injectable()
export class PalIdle extends Idle {
    constructor(expiry: SimpleExpiry) {
        super(expiry, undefined);
    }
}

and then in my app.module

import { SimpleExpiry, IdleExpiry } from 'ng2-idle/core';
import { PalIdle } from './idle.hack';
...
providers: [
    PalIdle,
    SimpleExpiry,
    { provide: IdleExpiry, useExisting: SimpleExpiry },
  ],
...

and finally injecting the new class where needed

constructor(
    private idle: PalIdle,
  ) {}

from ng2-idle.

spicywhitefish avatar spicywhitefish commented on July 21, 2024

I also had difficulty with the "Optional" Keepalive provider.

export const ALL_IDLE_PROVIDERS = [
    LocalExpiry,
    {provide: IdleExpiry, useExisting: LocalExpiry},
    // The following hack is required to avoid DI errors
    {provide: KeepaliveSvc, useValue: undefined},
    Idle
];

Maybe the JS in the current release is compiled incorrectly?

from ng2-idle.

mdsauer avatar mdsauer commented on July 21, 2024

I am having the same issue but the fix above is not working for me. I am getting 'SimpleExpiry' is not exported by node_modules\ng2-idle\core.js (imported by app\app.module.js)'
I should mention that I am getting this error while executing rollup so I am facing this issue at another point in my build process.

from ng2-idle.

Tiuser4567 avatar Tiuser4567 commented on July 21, 2024

@mdsauer can you try import { SimpleExpiry } from 'ng2-idle/simpleexpiry';

from ng2-idle.

mdsauer avatar mdsauer commented on July 21, 2024

@Tiuser4567 That worked!
I changed my idle.hack.ts to:

    import { Injectable } from '@angular/core';
    import { Idle } from 'ng2-idle/idle';
    import { SimpleExpiry } from 'ng2-idle/simpleexpiry';
    @Injectable()
    export class PalIdle extends Idle {
        constructor(expiry: SimpleExpiry) {
          super(expiry, undefined);
        }
    }

I made similar changes to my app.module.ts:

import { SimpleExpiry } from 'ng2-idle/simpleexpiry';
import { IdleExpiry } from 'ng2-idle/idleexpiry';

I then also added ng2-idle to the commonjs rollup plugin:

        include: [
          'node_modules/rxjs/**',
          'node_modules/angular-in-memory-web-api/**',
          'node_modules/ng2-idle/**'
          ],

Thanks for the help!

from ng2-idle.

mdsauer avatar mdsauer commented on July 21, 2024

@dasis You are able to do the AOT compile? I am still getting Error: Error at .../aot/app/app.module.ngfactory.ts:72:32: Module '".../node_modules/ng2-idle/core"' has no exported member 'IDLE_PROVIDERS'. Are you doing anything special regarding ng2-idle in you systemjs.config.js or anywhere else?

from ng2-idle.

TheSniper102 avatar TheSniper102 commented on July 21, 2024

@dasis can you answer that question

http://www.codeproject.com/Questions/1148292/Angular-idel-user-state

from ng2-idle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.