2016-09-16 63 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