CommonModule

Exports all the basic Angular directives and pipes, such as NgIf, NgForOf, DecimalPipe, and so on. Re-exported by BrowserModule, which is included automatically in the root AppModule when you create a new app with the CLI new command.

导出所有基本的 Angular 指令和管道,例如 NgIfNgForOfDecimalPipe 等。 它会由 BrowserModule 进行二次导出,当你使用 CLI 的 new 命令创建新应用时,BrowserModule 会自动包含在根模块 AppModule 中。

See more...

class CommonModule { }

说明

  • The providers options configure the NgModule's injector to provide localization dependencies to members.

    providers 选项配置了 NgModule 的注入器,来为其成员提供本地化依赖。

  • The exports options make the declared directives and pipes available for import by other NgModules.

    exports 选项让这里声明的指令和管道可以被导入到其它 NgModule 中。

Providers

Provider
{ provide: NgLocalization, useClass: NgLocaleLocalization }

Directives

NameDescription
NgClass

Adds and removes CSS classes on an HTML element.

从 HTML 元素上添加和移除 CSS 类。

NgComponentOutlet

Instantiates a single Componenttype and inserts its Host View into current View. NgComponentOutlet provides a declarative approach for dynamic component creation.

NgForOf

The NgForOf directive instantiates a template once per item from an iterable. The context for each instantiated template inherits from the outer context with the given loop variable set to the current item from the iterable.

NgForOf 指令会为可迭代对象中的每一个条目实例化一个模板。实例化时的上下文环境来自其外部环境,它以当前正在迭代的条目作为循环变量。

NgIf

Conditionally includes a template based on the value of an expression.

根据 expression 表达式的值,有条件的包含某个模板。

NgPlural

Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.

NgPluralCase

Creates a view that will be added/removed from the parent NgPluralwhen the given expression matches the plural expression according to CLDR rules.

NgStyle

Update an HTML element styles.

修改 HTML 元素的样式。

NgSwitch

Adds / removes DOM sub-trees when the nest match expressions matches the switch expression.

根据内嵌的 match(匹配)表达式(match_express_*)与 switch(多路开关)表达式(switch_expression)的匹配结果,添加 / 删除 DOM 子树。

NgSwitchCase

Creates a view that will be added/removed from the parent NgSwitchwhen the given expression evaluate to respectively the same/different value as the switch expression.

如果指定的表达式的计算结果和 switch 表达式相同,就会在父指令 NgSwitch中创建一个视图;如果不同,则移除。

NgSwitchDefault

Creates a view that is added to the parent NgSwitchwhen no case expressions match the switch expression.

当没有任何 case 表达式匹配 switch 表达式的结果时,就会在父指令 NgSwitch中创建一个视图。

NgTemplateOutlet

Inserts an embedded view from a prepared TemplateRef.

根据一个提前备好的 TemplateRef 插入一个内嵌视图。

Pipes

NameDescription
AsyncPipe

Unwraps a value from an asynchronous primitive.

从一个异步回执中解出一个值。

CurrencyPipe

Transforms a number to a currency string, formatted according to locale rules that determine group sizing and separator, decimal-point character, and other locale-specific configurations.

把数字转换成金额字符串, 根据本地化规则进行格式化,这些规则会决定分组大小和分组分隔符、小数点字符以及其它与本地化环境有关的配置项。

DatePipe

Formats a date value according to locale rules.

根据区域设置规则格式化日期值。

DecimalPipe

Transforms a number into a string, formatted according to locale rules that determine group sizing and separator, decimal-point character, and other locale-specific configurations.

把数字转换成字符串, 根据本地化规则进行格式化,这些规则会决定分组大小和分组分隔符、小数点字符以及其它与本地化环境有关的配置项。

DeprecatedCurrencyPipe

Formats a number as currency using locale rules.

DeprecatedDatePipe

Formats a date according to locale rules.

DeprecatedDecimalPipe

Formats a number as text. Group sizing and separator and other locale-specific configurations are based on the active locale.

DeprecatedPercentPipe

Formats a number as percentage according to locale rules.

I18nPluralPipe

Maps a value to a string that pluralizes the value according to locale rules.

I18nSelectPipe

Generic selector that displays the string that matches the current value.

JsonPipe

Converts a value into its JSON-format representation. Useful for debugging.

把一个值转换成 JSON 字符串格式。在调试时很有用。

KeyValuePipe

Transforms Object or Map into an array of key value pairs.

LowerCasePipe

Transforms text to all lower case.

把文本转换成全小写形式。

PercentPipe

Transforms a number to a percentage string, formatted according to locale rules that determine group sizing and separator, decimal-point character, and other locale-specific configurations.

把数字转换成百分比字符串, 根据本地化规则进行格式化,这些规则会决定分组大小和分组分隔符、小数点字符以及其它与本地化环境有关的配置项。

SlicePipe

Creates a new Array or String containing a subset (slice) of the elements.

从一个 ArrayString 中创建其元素一个新子集(slice)。

TitleCasePipe

Transforms text to title case. Capitalizes the first letter of each word, and transforms the rest of the word to lower case. Words are delimited by any whitespace character, such as a space, tab, or line-feed character.

把文本转换成标题形式。 把每个单词的第一个字母转成大写形式,并把单词的其余部分转成小写形式。 单词之间用任意空白字符进行分隔,比如空格、Tab 或换行符。

UpperCasePipe

Transforms text to all upper case.

把文本转换成全大写形式。