{ "id": "api/common/CommonModule", "title": "CommonModule", "contents": "\n\n
\n
\n
\n \n API > @angular/common\n
\n \n
\n \n
\n

CommonModulelink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

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

\n\n

See more...

\n
\n \n \n \n
\n\nclass CommonModule {\n}\n\n\n \n \n\n
\n\n\n \n\n \n \n \n
\n

Descriptionlink

\n
    \n
  • The providers options configure the NgModule's injector to provide\nlocalization dependencies to members.
  • \n
  • The exports options make the declared directives and pipes available for import\nby other NgModules.
  • \n
\n\n \n
\n\n \n\n \n\n \n\n \n\n\n \n\n\n \n \n
\n

Providerslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n
Provider
\n \n { provide: NgLocalization, useClass: NgLocaleLocalization }\n \n
\n
\n\n \n\n \n \n
\n

Directiveslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
NameDescription
\n \n NgClass\n \n \n \n

Adds and removes CSS classes on an HTML element.

\n\n
\n \n NgComponentOutlet\n \n \n \n

Instantiates a single Component type and inserts its Host View into current View.\nNgComponentOutlet provides a declarative approach for dynamic component creation.

\n\n
\n \n NgForOf\n \n \n \n

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

\n\n
\n \n NgIf\n \n \n \n

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

\n\n
\n \n NgPlural\n \n \n \n

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

\n\n
\n \n NgPluralCase\n \n \n \n

Creates a view that will be added/removed from the parent NgPlural when the\ngiven expression matches the plural expression according to CLDR rules.

\n\n
\n \n NgStyle\n \n \n \n

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

\n\n
\n \n NgSwitch\n \n \n \n

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

\n
    \n
  • Every view that matches is rendered.
  • \n
  • If there are no matches, a view with the ngSwitchDefault directive is rendered.
  • \n
  • Elements within the [NgSwitch] statement but outside of any NgSwitchCase\nor ngSwitchDefault directive are preserved at the location.
  • \n
\n\n
\n \n NgSwitchCase\n \n \n \n

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

\n\n
\n \n NgSwitchDefault\n \n \n \n

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

\n\n
\n \n NgTemplateOutlet\n \n \n \n

Inserts an embedded view from a prepared TemplateRef.

\n\n
\n
\n\n \n \n \n
\n

Pipeslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
NameDescription
\n \n AsyncPipe\n \n \n \n

Unwraps a value from an asynchronous primitive.

\n\n
\n \n CurrencyPipe\n \n \n \n

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

\n\n
\n \n DatePipe\n \n \n \n

Formats a date value according to locale rules.

\n\n
\n \n DecimalPipe\n \n \n \n

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

\n\n
\n \n I18nPluralPipe\n \n \n \n

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

\n\n
\n \n I18nSelectPipe\n \n \n \n

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

\n\n
\n \n JsonPipe\n \n \n \n

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

\n\n
\n \n KeyValuePipe\n \n \n \n

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

\n\n
\n \n LowerCasePipe\n \n \n \n

Transforms text to all lower case.

\n\n
\n \n PercentPipe\n \n \n \n

Transforms a number to a percentage\nstring, formatted according to locale rules that determine group sizing and\nseparator, decimal-point character, and other locale-specific\nconfigurations.

\n\n
\n \n SlicePipe\n \n \n \n

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

\n\n
\n \n TitleCasePipe\n \n \n \n

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

\n\n
\n \n UpperCasePipe\n \n \n \n

Transforms text to all upper case.

\n\n
\n
\n\n \n\n\n \n\n\n
\n
\n\n\n" }