填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

CommonModule

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

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.

查看"说明"...

      
      class CommonModule {
}
    

说明

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

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

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

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

提供商

提供商
      
      { provide: NgLocalization, useClass: NgLocaleLocalization }
    

指令

名称说明
      
      NgClass
    

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

Adds and removes CSS classes on an HTML element.

      
      NgComponentOutlet
    

实例化单个 Component类型,并将其宿主视图插入当前视图。NgComponentOutlet 为动态组件创建提供了一种声明式方法。

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

      
      NgForOf
    

一种结构型指令,为集合中的每个条目渲染一个模板。如果指令放置在一个元素上,该元素就会成为克隆后的模板的父级。

A structural directive that renders a template for each item in a collection. The directive is placed on an element, which becomes the parent of the cloned templates.

      
      NgIf
    

本结构型指令用于根据表达式的值(强转为 boolean)是否为真值,来有条件的包含某个模板。当表达式计算为 true 时,Angular 会渲染 then 子句中提供的模板,当为 false 或 null 时则渲染可选的 else 子句中的模板。else 子句的默认模板是空白模板。

A structural directive that conditionally includes a template based on the value of an expression coerced to Boolean. When the expression evaluates to true, Angular renders the template provided in a then clause, and when false or null, Angular renders the template provided in an optional else clause. The default template for the else clause is blank.

      
      NgPlural
    

根据数字值添加/删除 DOM 子树。为支持复数词量身定制。

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

      
      NgPluralCase
    

创建一个视图,当给定表达式根据 CLDR 规则与复数表达式匹配时,将在父视图 NgPlural中添加/删除该视图。

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

      
      NgStyle
    

一个属性指令,用于更新容器元素的样式。可以通过指定用冒号分隔的键值对来设置一个或多个样式属性。其键是样式名称,带有可选的 <unit> 后缀(比如 'top.px','font-style.em');其值是待求值的表达式。如果求值结果不是 null,则把用指定单位表示的结果赋值给指定的样式属性;如果是 null,则删除相应的样式。

An attribute directive that updates styles for the containing HTML element. Sets one or more style properties, specified as colon-separated key-value pairs. The key is a style name, with an optional .<unit> suffix (such as 'top.px', 'font-style.em'). The value is an expression to be evaluated. The resulting non-null value, expressed in the given unit, is assigned to the given style property. If the result of evaluation is null, the corresponding style is removed.

      
      NgSwitch
    

容器上的 [ngSwitch] 指令指定要匹配的表达式。匹配的表达式由容器内视图上的 ngSwitchCase 指令提供。

The [ngSwitch] directive on a container specifies an expression to match against. The expressions to match are provided by ngSwitchCase directives on views within the container.

      
      NgSwitchCase
    

提供一个 switch case 表达式来匹配一个封闭的 ngSwitch 表达式。当表达式匹配时,将渲染给定的 NgSwitchCase 模板。如果多个匹配表达式与开关表达式值相匹配,则会全部显示。

Provides a switch case expression to match against an enclosing ngSwitch expression. When the expressions match, the given NgSwitchCase template is rendered. If multiple match expressions match the switch expression value, all of them are displayed.

      
      NgSwitchDefault
    

创建一个当没有任何 NgSwitchCase 表达式能匹配 NgSwitch 表达时要渲染的视图。该语句应该是 NgSwitch 的最后一种情况。

Creates a view that is rendered when no NgSwitchCase expressions match the NgSwitch expression. This statement should be the final case in an NgSwitch.

      
      NgTemplateOutlet
    

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

Inserts an embedded view from a prepared TemplateRef.

管道

名称说明
      
      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
    

Formats a value according to digit options and locale rules. Locale determines group sizing and separator, decimal point character, and other locale-specific configurations.

      
      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
    

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

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

      
      KeyValuePipe
    

将 Object 或 Map 转换为键值对数组。

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
    

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

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

      
      TitleCasePipe
    

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

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.

      
      UpperCasePipe
    

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

Transforms text to all upper case.