[Angular 2] Import custom module

The application structure:

in app.module.ts:

import { NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {AppComponent} from './app.component';
import {HomeModule} from './components/home/home.module';

@NgModule({
    imports:[BrowserModule, HomeModule],
    declarations:[AppComponent],
    bootstrap:[AppComponent]
})
export class AppModule{}

 

components/home/home.module.ts:

import { NgModule} from '@angular/core';
import {HomeComponent} from './home.component';
@NgModule({
    declarations: [HomeComponent],
    exports: [HomeComponent]
})
export class HomeModule {

}

 

posted @ 2016-09-19 18:16  Zhentiw  阅读(484)  评论(0编辑  收藏  举报