错误:无法解析路由器的所有参数:(?,?,?,?,?,?,?,?)

时间:2018-07-22 21:36:35

标签: angular-ui-router angular6

代码:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { OrganisationComponent } from './organisation/organisation.component';
import { AddressComponent } from './utils/address/address.component';
import { YearComponent } from './utils/year/year.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {SuiModule} from 'ng2-semantic-ui';
import { JwtModule } from '@auth0/angular-jwt';
import { LoginComponent } from './login/login.component';
import { AuthService } from './auth.service';
import { AuthGuard } from './auth.guard';
import { HttpClientModule } from '@angular/common/http'; 
import { RouterModule, Router } from '@angular/router';
export function tokenGetter() {
  return localStorage.getItem('access_token');
}

@NgModule({
  declarations: [
    AppComponent,
    OrganisationComponent,
    AddressComponent,
    YearComponent,
    LoginComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    SuiModule,
    HttpClientModule,
    RouterModule,
    JwtModule.forRoot({
      config: {
        tokenGetter: tokenGetter,
        whitelistedDomains: ['localhost:4000'],
        blacklistedRoutes: ['localhost:4000/api/auth']
      }
    })
  ],
  providers: [
    AuthService,
    AuthGuard,
    Router
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

当我未添加路由器时,它显示在错误下面:

  

错误:StaticInjectorError(AppModule)[RouterLinkActive->路由器]:
  StaticInjectorError(平台:核心)[RouterLinkActive->路由器]:       NullInjectorError:没有路由器的提供程序!

当我添加路由器时,它显示在错误下面:

  

错误:无法解析路由器的所有参数:(?,?,?,?,?,?,?,   ?)。

0 个答案:

没有答案