2016-11-15 1 views
2

AngularJS 2 응용 프로그램에서 ng2-idle으로 작업하고 있습니다. 프로젝트의 node_modules 폴더에서 ng2 유휴 패키지를 가져올 수있었습니다.잡히지 않음 (약속 있음) : 유휴 공급자 없음

Dashboard.component.ts : 나는 다음과 같은 내 구성 요소 중 하나로 가져하려고

import { Ng2IdleModule } from 'ng2-idle/index'; 
import { DEFAULT_INTERRUPTSOURCES } from 'ng2-idle/index'; 
import { Idle } from 'ng2-idle/idle'; 

//location and router 
import { Router } from '@angular/router'; 


import { AppComponent } from '../../app.component'; 

@Component({ 

    selector: 'dashboard', 
    templateUrl: './dashboard.component.html' 
}) 

export class DashboardComponent { 
    private showBusyIndicator: boolean = false; 
    private idleState: string = 'Not started.'; 
    private timedOut: boolean = false; 
    constructor(@Host() @Inject(forwardRef(() => AppComponent)) private app: AppComponent, 
     private idle: Idle) {//throws an error when I include it in the constructor 

    } 

} 

나는 다음과 같은 오류 얻을 수행 할 때

message:Uncaught (in promise): Error: Error in ./DashboardComponent class DashboardComponent_Host - inline template:0:0 caused by: No provider for Idle! 
Error: No provider for Idle! 
    at NoProviderError.BaseError [as constructor] (http://localhost:4200/main.bundle.js:7103:34) 
    at NoProviderError.AbstractProviderError [as constructor] (http://localhost:4200/main.bundle.js:62865:16) 
    at new NoProviderError (http://localhost:4200/main.bundle.js:62896:16) 
    at ReflectiveInjector_._throwOrNull (http://localhost:4200/main.bundle.js:101281:19) 
    at ReflectiveInjector_._getByKeyDefault (http://localhost:4200/main.bundle.js:101309:25) 
    at ReflectiveInjector_._getByKey (http://localhost:4200/main.bundle.js:101272:25) 
    at ReflectiveInjector_.get (http://localhost:4200/main.bundle.js:101081:21) 
    at AppModuleInjector.NgModuleInjector.get (http://localhost:4200/main.bundle.js:63774:52) 
    at ElementInjector.get (http://localhost:4200/main.bundle.js:101472:48) 
    at ElementInjector.get (http://localhost:4200/main.bundle.js:101472:48) 
source: 
stack trace:null 

내가 AppModule에서 가져 오기 다음과 같은 오류가 발생했습니다 :

metadata_resolver.js:227Uncaught Error: Unexpected value 'Ng2IdleModule' imported by the module 'AppModule'(…) 

내 app.mo에 모듈을 가져 오지 않았습니다. dule.ts. 그래서이 오류가 발생하는 이유는 무엇입니까? 이 문제를 어떻게 해결할 수 있는지 알려 주시기 바랍니다.

+0

글쎄, 왜 AppModule에서 가져 오기를 시도하지? –

+0

@AlexanderCiesielski AppModule에서 가져 오기를 시도 할 때 발생하는 오류로 질문을 업데이트했습니다. – Valla

답변

관련 문제