Angular2引导模块进入模块

时间:2016-12-01 23:32:35

标签: angular typescript

我试图收集我写的所有代码:) 我想将一些模块(Auth)引导到根模块,但是有错误:

Error: (SystemJS) Unexpected module 'AuthModule' declared by the module 'AppModule'

这里是main.ts:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './pg.module';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

和AppModule(pg.module):

import {NgModule}      from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {HttpModule}    from '@angular/http';
import {FormsModule}   from '@angular/forms';

import {AuthModule}   from './components/auth/auth.module';

@NgModule({
    imports: [
        BrowserModule,
        HttpModule,
        FormsModule,
        AuthModule
    ],
    declarations: [],
    bootstrap: [AuthModule]
})
export class AppModule {
}

和AuthModule:

import {NgModule}      from '@angular/core';
// import {BrowserModule} from '@angular/platform-browser';
// import {HttpModule}    from '@angular/http';
// import {FormsModule}   from '@angular/forms';

import {Auth}   from './auth-panel/rg.auth';
import {Register} from './register/rg.register';
import {SocialLogin} from './social-login/rg.social.login';
import {StandardLogin} from './standard-login/rg.standard.login';
import {UserPanel} from './user-panel/rg.user.panel';

import {LoginService} from '../../services/login-service';

@NgModule({
    // imports: [
    //     // BrowserModule,
    //     // HttpModule,
    //     // FormsModule
    // ],
    declarations: [Auth, Register, SocialLogin, StandardLogin, UserPanel],
    providers: [LoginService],
    bootstrap: [Auth]
})
export class AuthModule {
}

所以... AuthModule包含一些我想要收集的组件。主要的Auth组件是Auth。它包含Register,SocialLogin,StandardLogin和UserPanel(因此所有组件都应该在声明中)。 我做错了什么?

0 个答案:

没有答案