i'm upgrading my Angular 2 project from RC5 to 2.0.0. I get this Error
Unhandled Promise rejection: Component LoginComponent is
not part of any NgModule or the module has not been imported into your
module. ; Zone: ; Task: Promise.then ; Value: Error: Component
Main.ts:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
AppModule:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import {RouterModule} from "@angular/router";
import {AppsAdminComponent} from './AppsAdmin/AppsAdmin.component';
import {AppsManagerComponent} from './AppsManager/AppsManager.component';
import {LoginComponent} from './Login/Login.component';
import {LogoutComponent} from './Logout/logout.component';
import { Routing } from './App.routing';
import {HttpModule} from '@angular/http';
//import {AppsManagerService} from './Service/AppsManager.service';
import {GlobalService} from './Service/GlobalService';
import {Webservice} from './Service/Webservice';
@NgModule({
declarations: [
AppComponent,
LoginComponent,
LogoutComponent,
AppsAdminComponent,
AppsManagerComponent
],
imports: [
BrowserModule,
HttpModule,
FormsModule,
Routing
],
providers: [
GlobalService,
Webservice
],
bootstrap: [
AppComponent
]
})
export class AppModule {
}
Login @Component:
@Component({
selector: 'Login',
templateUrl: 'App/Login/Login.html',
providers: [LoginService],
styleUrls: ['App/Login/Login.css']
})
What is wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…