NG Basis

@NgModule({
    declarations: [],   // 用到的组件,指令,管道
    providers: [],      // 依赖注入服务 
    imports: [],        // 导入需要的模块
    exports: [],        // 导出的模块,跨模块交流
    entryComponents: [],// 需提前编译好的模块
    bootstrap: []       // 设置根组件
})
export class AppModule { }

declarations

  • 声明本模块中拥有的视图类。Angular 有三种视图类:组件 指令和管道

providers

  • 服务的创建者,并加入到全局服务列表中,可用于应用任何部分

imports

  • 本模块声明的组件模板需要的类在其它模块。

exports

  • declarations的子集可用于其它模块的组件模板。

bootstrap

  • 指定应用的主视图(根组件)它是其它视图的宿主。只有根模块才能设置bootstrap属性。

angular 提供的模块

@angular/core

  • NgModule:模块定义装饰器
  • Component:组件定义装饰器
  • Directive:指令定义装饰器
  • Pipe :管道定义装饰器
  • PipeTransform:管道接口
  • Injectable:服务定义装饰器
  • ElmentRef:元素引用
  • ViewChild:获取子元素
  • Render:渲染
  • Input:接受参数输入
  • Output:事件输出
  • EventEmitter:触发自定义事件

@angular/common

  • CommonModule:通用模块,包含内置指令ngIf,ngFor

@angular/forms

  • FormsModule:定义模版驱动表单
  • ReactiveFormsModule:定义响应式表单
  • FormGroup, FormArray, FormControl, FormBuilder:响应式表单元素
  • Validators:表单校验

@angular/http

  • HttpModule:http请求模块

@angular/router

  • RouterModule 路由模块
  • Routes 路由数据结构

@angular/platform-browser

  • platformBrowser:AoT编译
  • BrowserModule:浏览器支持,注意该模块导入了CommonModule,然后导出去,所以引用了这个模块也就引用了CommonModule

@angular/platform-browser-dynamic

  • platformBrowserDynamic:JIT编译
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值