Angular 2 idel用户状态 [英] Angular 2 idel user state

查看:99
本文介绍了Angular 2 idel用户状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试检测用户是否理想一段时间然后将其重定向到登录页面



i try to detect if user is ideal for some time then redirect him to login page

hi i have problem integrating (ng2-idle)[https://github.com/HackedByChinese/ng2-idle] with my angular 2 final release 2.0.1 application it's
```
No provider for Http!
```
the package.json enties for ng2-idle package
```
"ng2-idle": "1.0.0-alpha.16",
 "ng2-idle-keepalive": "1.0.0-alpha.9"
```
i have shared.module.ts which it shared across multiple components
the two providers for the ng2-idle are
```
 IDLE_PROVIDERS,
  KEEPALIVE_PROVIDERS
```
here is my shared.module.ts file
https://gist.github.com/TheSniper102/7991ed473c5f99ec1191d3ba14e79d02





我的尝试:



shared.module.ts·GitHub [ ^ ]

推荐答案

您尝试过吗?在提供商部分添加Idle和Keepalive?



Did you try adding Idle and Keepalive in the providers section?

import { Idle, IDLE_PROVIDERS} from "ng2-idle/core";
import { Keepalive, KEEPALIVE_PROVIDERS } from "ng2-idle-keepalive/core";

@NgModule({
    imports: [
        HttpModule

    ],
    providers: [
        Idle,
        Keepalive,
        KEEPALIVE_PROVIDERS,
        IDLE_PROVIDERS
    ],
})
export class SharedModule { } 


这篇关于Angular 2 idel用户状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆