2017-05-03 2 views
0

없음 공급자, 나는 데 문제가 No provider for ReloginComponent오류는 매우 정직 각도 ReloginComponent 4

이 먼저라는 오류를 얻을 수있다, 이것은 내가 뭐하는 거지입니다. 나는 주입을 통해 서비스 내부의 컴포넌트를 호출한다.

예 : if 문에

this.relogin.showDialog(); :

@Injectable() 
export class HttpUtil { 

    constructor(private http: Http, private relogin: ReloginComponent) { } 

private catchAuthError (self: HttpUtil) { 
     // we have to pass HttpService's own instance here as `self` 
     return (res: Response) => { 

      if (res.status === 401 || res.status === 403 || res.status === 500) { 

       //TODO: route the user to the login page again and make a 500 ERROR page 
       // if not authenticated 
       console.log("ERROR: "+res); 

       this.relogin.showDialog(); 

      } 
      return Observable.throw('Not authenticated: '+res); 
     }; 
    } 

나는 사용자가를 통해 오류를 얻는 경우에 팝업가 발생하도록 노력하고 있습니다.

이것은 내 나는 심지어 ServiceModule에 추가하려고 ReloginModule

@NgModule({ 
    imports:[ 
     DialogModule 
    ], 

    declarations:[ 
     ReloginComponent 
    ], 

    exports: [ 
     ReloginComponent, 
    ], 
    providers: [ 
     ReloginService 
    ] 
}) 
export class ReloginModule { 

} 

:

@NgModule({ 
    imports:[ 
     SmartadminModule, 
     ReloginModule 
    ], 

    exports: [ 

    ], 

    providers:[ 
     ReloginService 
    ] 
}) 
export class ServicesModule{} 

모든 것을 내가 app.module에 추가에 실패합니다.

이 시점에서 어디에서 추가 할지를 알 수 없습니다.

+0

개인용 @Inject (ReloginComponent) relogin : ReloginComponent –

+0

Ok 오류는 사라졌지만 팝업되지 않습니다. 그것으로 지금보십시오. – Drew1208

+0

답변으로 추가됨 :) –

답변