NgModule
把一个类标记为 NgModule,并提供配置元数据。
Decorator that marks a class as an NgModule and supplies configuration metadata.
选项 | 说明 |
---|---|
providers | 在当前模块的注入器中可用的一组可注入对象。 The set of injectable objects that are available in the injector of this module. |
declarations | 属于该模块的一组组件、指令和管道(统称可声明对象)。 The set of components, directives, and pipes (declarables) that belong to this module. |
imports | 这里列出的 NgModule 所导出的可声明对象可用在当前模块内的模板中。 The set of NgModules whose exported declarables are available to templates in this module. |
exports | 此 NgModule 中声明的一组组件、指令和管道可以在导入了本模块的模块下任何组件的模板中使用。 导出的这些可声明对象就是该模块的公共 API。 The set of components, directives, and pipes declared in this NgModule that can be used in the template of any component that is part of an NgModule that imports this NgModule. Exported declarations are the module's public API. |
entryComponents | 定义此 NgModule 中要编译的组件集,这样它们才可以动态加载到视图中。 The set of components to compile when this NgModule is defined, so that they can be dynamically loaded into the view. |
bootstrap | 当该模块引导时需要进行引导的组件。列在这里的所有组件都会自动添加到 The set of components that are bootstrapped when this module is bootstrapped. The components listed here are automatically added to |
schemas | 该 NgModule 中允许使用的声明元素的 schema(HTML 架构)。 元素和属性(无论是 Angular 组件还是指令)都必须声明在 schema 中。 The set of schemas that declare elements to be allowed in the NgModule. Elements and properties that are neither Angular components nor directives must be declared in a schema. |
id | 当前 NgModule 在 A name or path that uniquely identifies this NgModule in |
jit | 如果为 If true, this module will be skipped by the AOT compiler and so will always be compiled using JIT. |