2017-05-22 7 views
1

Ich habe folgende Fehlermeldung:Argument des Typs 'Http' ist nicht zuordenbare Parameter des Typs 'Http'

[ts] Argument of type 'Http' is not assignable to parameter of type 'Http'. Property '_backend' is protected but type 'Http' is not a class derived from 'Http'. (parameter) http: Http

Dieser Fehler ist in der Datei auth.module.ts

import { NgModule } from '@angular/core'; 
import { Http, RequestOptions } from '@angular/http'; 

import { AuthHttp, AuthConfig } from 'angular2-jwt' 

import { AuthService } from './auth.service'; 
import { AuthGuard } from './auth.guard'; 
import { RoleGuard } from './role.guard'; 
import { GuestGuard } from './guest.guard'; 

export function authHttpServiceFactory(http: Http, options: RequestOptions) { 
    return new AuthHttp(new AuthConfig(), http, options); 
} 

@NgModule({ 
    providers: [ 
    AuthService, 
    AuthGuard, 
    RoleGuard, 
    GuestGuard, 
    { 
     provide: AuthHttp, 
     useFactory: authHttpServiceFactory, 
     deps: [Http, RequestOptions] 
    } 
    ] 
}) 
export class AuthModule {} 

Was ist falsch?

+0

Welche Versionen von angular und angular2-jwt verwenden Sie? – jgranstrom

+0

"eckig2-jwt": "^ 0.2.0" package.json https://pastebin.com/gYiqMV5m – Defus

+0

Ich kann keine offensichtlichen Fehler in Ihrem Code sehen, aber ich kann die Versionen Ihrer eckigen Module nicht sehen in der package.json hast du gepostet. Sind Ihre Winkelmodule vor Version 2.4.2? – jgranstrom

Antwort

0

Überprüfen Sie, ob Sie eine Bibliothek haben, auf die mit npm link verwiesen wird. Es gibt issue with linked dependencies.

Würde gerne mehr helfen, aber ich kämpfe derzeit mit dem gleichen Problem in verschiedenen Setup.

Verwandte Themen