zoukankan      html  css  js  c++  java
  • @NgModule

    @NgModule 的使用方式
    看一个最简单的 @NgModule 的定义:

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';

    import { AppComponent } from './app.component';
    import { TestViewChildComponent } from './test-view-child/test-view-child.component';
    import { ChildOneComponent } from './test-view-child/child-one/child-one.component';

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


    declarations:用来放组件、指令、管道的声明。
    imports:用来导入外部模块。
    providers:需要使用的 Service 都放在这里。
    bootstrap:定义启动组件。你可能注意到了这个配置项是一个数组,也就是说可以指定做个组件作为启动点,但是这种用法是很罕见的。

  • 相关阅读:
    Matplotlib 绘图库 基本使用方法
    linux socat命令
    linux shell重定向
    linux man命令
    bashttpd使用手册
    libcurl代码示例
    vim文件头部注释配置
    linux join命令
    iterm2切换显示屏vim乱行解决
    分形与混沌
  • 原文地址:https://www.cnblogs.com/zhouyx/p/14343651.html
Copyright © 2011-2022 走看看