TheUnreal
TheUnreal

Reputation: 24462

Angular 2 upgrade from RC4 to RC7

I'm trying to upgrade an app from RC4 to RC7 and I have created an app.module.ts in my src/app folder.

my main.ts in my src folder has the following line:

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

Which returns the following error:

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'.

Why I get this error? I did the same as another project which works..

my 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 {

}

Upvotes: 0

Views: 125

Answers (1)

ranakrunal9
ranakrunal9

Reputation: 13558

You have to create index.ts in app folder to export AppModule :

//index.ts

export * from './app.module';

Or you can import AppModule in your main.ts as follows :

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

Upvotes: 1

Related Questions