1
私はangular2-JWTでangular2とjsonのWebトークンを導入しています。私はここで angular2-jwt CompileMetadataResolverエラー
AuthHttp
クラスのオブジェクトをインスタンス化するいくつかの問題を抱えていた私はコンストラクタを追加すると、私のapp.module.tsimport { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HTTP_PROVIDERS, Http } from '@angular/http';
import { AuthHttp, AuthConfig, AUTH_PROVIDERS, provideAuth } from 'angular2-jwt';
import { AppComponent } from './app.component';
import { IndexComponent } from './Components/Index/index.component';
import { AuthService } from './Services/auth.service';
import { routing } from './app.routing';
@NgModule({
imports: [
BrowserModule,
routing,
],
declarations: [
AppComponent,
IndexComponent,
],
providers: [
AuthService,
AuthHttp,
provideAuth({
headerName: 'Authorization',
headerPrefix: 'bearer',
tokenName: 'token',
tokenGetter: (() => localStorage.getItem('id_token')),
globalHeaders: [{ 'Content-Type': 'application/json' }],
noJwtError: true
})
]
bootstrap: [AppComponent]
})
export class AppModule { }
と私のauth.service.ts
import { Injectable } from '@angular/core';
@Injectable()
export class AuthService {
constructor(public authHttp: AuthHttp) {}
}
です私のサービスは、私が
Error: CompileMetadataResolver</[email protected]://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14388:1
CompileMetadataResolver</[email protected]://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14285:23
CompileMetadataResolver</CompileMetadataResolver.prototype.getProvidersMetadata/<@http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14432:37
CompileMetadataResolver</[email protected]://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14412:11
CompileMetadataResolver</[email protected]://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14173:55
RuntimeCompiler</[email protected]://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16777:26
RuntimeCompiler</[email protected]://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16715:34
RuntimeCompiler</[email protected]://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16706:18
PlatformRef_</[email protected]://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:9488:20
PlatformRef_</[email protected]://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:9470:20
@http://localhost:3000/app/main.js:4:1
@http://localhost:3000/app/main.js:1:1
@http://localhost:3000/app/main.js:1:1
Zone</ZoneDelegate</[email protected]://localhost:3000/node_modules/zone.js/dist/zone.js:332:20
Zone</Zone</[email protected]://localhost:3000/node_modules/zone.js/dist/zone.js:225:25
scheduleResolveOrReject/<@http://localhost:3000/node_modules/zone.js/dist/zone.js:591:53
Zone</ZoneDelegate</[email protected]://localhost:3000/node_modules/zone.js/dist/zone.js:365:24
Zone</Zone</[email protected]://localhost:3000/node_modules/zone.js/dist/zone.js:265:29
[email protected]://localhost:3000/node_modules/zone.js/dist/zone.js:497:26
ZoneTask/[email protected]://localhost:3000/node_modules/zone.js/dist/zone.js:437:26
Evaluating http://localhost:3000/app/main.js
Error loading http://localhost:3000/app/main.js