CommonModule

From Get docs
< @angular/commonAngular/docs/11/api/common/commonmodule


CommonModule

ngmodule

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.

See more...

class CommonModule {
}

Description

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

Providers

Provider
{ provide: NgLocalization, useClass: NgLocaleLocalization }

Directives

Name Description

../ngclass

NgClass
Adds and removes CSS classes on an HTML element.

../ngcomponentoutlet

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

../ngforof

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

NgIf
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

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

../ngpluralcase

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

../ngstyle

NgStyle
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

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.

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

../ngswitchcase

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

NgSwitchDefault
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

NgTemplateOutlet
Inserts an embedded view from a prepared TemplateRef.

Pipes

Name Description

../asyncpipe

AsyncPipe
Unwraps a value from an asynchronous primitive.

../currencypipe

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

DatePipe
Formats a date value according to locale rules.

../decimalpipe

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

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

../i18nselectpipe

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

../jsonpipe

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

../keyvaluepipe

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

../lowercasepipe

LowerCasePipe
Transforms text to all lower case.

../percentpipe

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

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

../titlecasepipe

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.

../uppercasepipe

UpperCasePipe
Transforms text to all upper case.


© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/api/common/CommonModule