2016-09-16 76 views
0

我正在嘗試將應用從RC4升級到RC7,並在我的src/app文件夾中創建了一個app.module.ts。Angular 2從RC4升級到RC7

我main.ts在我src文件夾中有如下一行:

import { AppModule } from './app/'; 

它返回以下錯誤:爲什麼我得到這個錯誤

WARNING in ./src/main.ts 
9:41 export 'AppModule' was not found in './app/' 

ERROR in [default] c:\xampp\htdocs\newPROJECT\src\main.ts:6:9 
Module '"c:/xampp/htdocs/newPROJECT/src/app/index"' has no exported member 'AppModule'. 

?我做了另一個相同項目,工程..

我app.module.ts

import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule, ApplicationRef} from '@angular/core'; 
import { CommonModule } from '@angular/common'; 
import { HttpModule,RequestOptions } from '@angular/http'; 
import { FormsModule} from '@angular/forms'; 
import { routing, 
     appRoutingProviders } from './app.routing'; 

//Routes 
import { ComboFinderComponent } from './combo-finder/combo-finder.component'; 

@NgModule({ 
    declarations: [ 
    AppComponent, 
    ComboFinderComponent 
    ], 
    imports: [ 
    BrowserModule, 
    CommonModule, 
    FormsModule, 
    HttpModule, 
    routing, 
    ], 
    providers: [ 
    {provide:RequestOptions, useClass: CustomRequestOptions } 
    ], 
    entryComponents: [AppComponent], 
    bootstrap: [AppComponent] 
}) 
export class AppModule { 

} 

回答

1

你必須app文件夾中創建index.ts出口AppModule

//index.ts

export * from './app.module'; 

或者你可以在你的main.ts導入AppModule如下:

import { AppModule } from './app/app.module'; 
+0

就是這樣。謝謝! – TheUnreal