我是Angular 2中的新成員我需要路由部分的幫助。我使用http://jasonwatmore.com/post/2016/09/29/angular-2-user-registration-and-login-example-tutorial
我得到一個錯誤
出口變量「路由」已經或正在使用的名稱「ModuleWithProviders」從外部模塊「的/ home /坦白/角/ node_modules/@角/核心/ src/metadata/ng_module「,但無法命名。
這裏是我的代碼
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
// used to create fake backend
import { fakeBackendProvider } from './_helpers/index';
import { MockBackend, MockConnection } from '@angular/http/testing';
import { BaseRequestOptions } from '@angular/http';
import { AppComponent } from './app.component';
import { routing } from './app.routing';
import { AlertComponent } from './_directives/index';
import { AuthGuard } from './_guards/index';
import { AlertService, AuthenticationService, UserService } from './_services/index';
import { HomeComponent } from './home/index';
import { LoginComponent } from './login/index';
import { RegisterComponent } from './register/index';
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
routing
],
declarations: [
AppComponent,
AlertComponent,
HomeComponent,
LoginComponent,
RegisterComponent
],
providers: [
AuthGuard,
AlertService,
AuthenticationService,
UserService,
// providers used to create fake backend
fakeBackendProvider,
MockBackend,
BaseRequestOptions
],
bootstrap: [AppComponent]
})
export class AppModule { }
上的錯誤任何想法?我也嘗試過從'@ angular/core'中使用seimport {ModuleWithProviders}; tting我的「聲明」:true,在tsconfig.js中,也導入
你可以顯示'app.routing'文件。看起來這是錯誤來自的地方 –