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

@angular/commonlink

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

Implements fundamental Angular framework functionality, including directives and pipes, location services used in routing, HTTP services, localization support, and so on.

\n\n

The CommonModule exports are re-exported by BrowserModule, which is included automatically in the root AppModule when you create a new app with the CLI new command.

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

Entry pointslink

\n \n \n \n
\n

Primarylink

\n \n \n \n \n \n \n \n
@angular/common\n \n

Implements fundamental Angular framework functionality, including directives and pipes, location services used in routing, HTTP services, localization support, and so on.

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

Secondarylink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
@angular/common/http\n \n

Implements an HTTP client API for Angular apps that relies on the XMLHttpRequest interface exposed by browsers.

\n\n
@angular/common/http/testing\n \n

Supplies a testing module for the Angular HTTP subsystem.

\n\n
@angular/common/testing\n \n

Supplies infrastructure for testing functionality supplied by @angular/common.

\n\n
@angular/common/upgrade\n \n

Provides tools for upgrading from the $location service provided in AngularJS\nto Angular's unified location service.

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

Primary entry point exportslink

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

NgModuleslink

\n \n \n \n \n \n \n \n
CommonModule\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
\n
\n \n\n \n \n \n
\n

Classeslink

\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
HashLocationStrategy\n \n

A LocationStrategy used to configure the Location service to\nrepresent its state in the\nhash fragment\nof the browser's URL.

\n\n
Location\n \n

A service that applications can use to interact with a browser's URL.

\n\n
LocationStrategy\n \n

Enables the Location service to read route state from the browser's URL.\nAngular provides two strategies:\nHashLocationStrategy and PathLocationStrategy.

\n\n
NgForOfContext\n \n \n
NgIfContext\n \n \n
NgLocaleLocalization\n \n

Returns the plural case based on the locale

\n\n
NgLocalization\n \n \n
PathLocationStrategy\n \n

A LocationStrategy used to configure the Location service to\nrepresent its state in the\npath of the\nbrowser's URL.

\n\n
PlatformLocation\n \n

This class should not be used directly by an application developer. Instead, use\nLocation.

\n\n
ViewportScroller\n \n

Defines a scroll position manager. Implemented by BrowserViewportScroller.

\n\n
XhrFactory\n \n

A wrapper around the XMLHttpRequest constructor.

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

Functionslink

\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 \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 \n \n \n \n \n \n \n
formatCurrency\n \n

Formats a number as currency using locale rules.

\n\n
formatDate\n \n

Formats a date according to locale rules.

\n\n
formatNumber\n \n

Formats a number as text, with group sizing, separator, and other\nparameters based on the locale.

\n\n
formatPercent\n \n

Formats a number as a percentage according to locale rules.

\n\n
getCurrencySymbol\n \n

Retrieves the currency symbol for a given currency code.

\n\n
getLocaleCurrencyCode\n \n

Retrieves the default currency code for the given locale.

\n\n
getLocaleCurrencyName\n \n

Retrieves the name of the currency for the main country corresponding\nto a given locale. For example, 'US Dollar' for en-US.

\n\n
getLocaleCurrencySymbol\n \n

Retrieves the symbol used to represent the currency for the main country\ncorresponding to a given locale. For example, '$' for en-US.

\n\n
getLocaleDateFormat\n \n

Retrieves a localized date-value formating string.

\n\n
getLocaleDateTimeFormat\n \n

Retrieves a localized date-time formatting string.

\n\n
getLocaleDayNames\n \n

Retrieves days of the week for the given locale, using the Gregorian calendar.

\n\n
getLocaleDayPeriods\n \n

Retrieves day period strings for the given locale.

\n\n
getLocaleDirection\n \n

Retrieves the writing direction of a specified locale

\n\n
getLocaleEraNames\n \n

Retrieves Gregorian-calendar eras for the given locale.

\n\n
getLocaleExtraDayPeriodRules\n \n

Retrieves locale-specific rules used to determine which day period to use\nwhen more than one period is defined for a locale.

\n\n
getLocaleExtraDayPeriods\n \n

Retrieves locale-specific day periods, which indicate roughly how a day is broken up\nin different languages.\nFor example, for en-US, periods are morning, noon, afternoon, evening, and midnight.

\n\n
getLocaleFirstDayOfWeek\n \n

Retrieves the first day of the week for the given locale.

\n\n
getLocaleId\n \n

Retrieves the locale ID from the currently loaded locale.\nThe loaded locale could be, for example, a global one rather than a regional one.

\n\n
getLocaleMonthNames\n \n

Retrieves months of the year for the given locale, using the Gregorian calendar.

\n\n
getLocaleNumberFormat\n \n

Retrieves a number format for a given locale.

\n\n
getLocaleNumberSymbol\n \n

Retrieves a localized number symbol that can be used to replace placeholders in number formats.

\n\n
getLocalePluralCase\n \n

Retrieves the plural function used by ICU expressions to determine the plural case to use\nfor a given locale.

\n\n
getLocaleTimeFormat\n \n

Retrieves a localized time-value formatting string.

\n\n
getLocaleWeekEndRange\n \n

Range of week days that are considered the week-end for the given locale.

\n\n
getNumberOfCurrencyDigits\n \n

Reports the number of decimal digits for a given currency.\nThe value depends upon the presence of cents in that particular currency.

\n\n
isPlatformBrowser\n \n

Returns whether a platform id represents a browser platform.

\n\n
isPlatformServer\n \n

Returns whether a platform id represents a server platform.

\n\n
isPlatformWorkerApp\n \n

Returns whether a platform id represents a web worker app platform.

\n\n
isPlatformWorkerUi\n \n

Returns whether a platform id represents a web worker UI platform.

\n\n
registerLocaleData\n \n

Register global data to be used internally by Angular. See the\n\"I18n guide\" to know how to import additional locale data.

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

Structureslink

\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
FormStyle\n \n

Context-dependant translation forms for strings.\nTypically the standalone version is for the nominative form of the word,\nand the format version is used for the genitive case.

\n\n
FormatWidth\n \n

String widths available for date-time formats.\nThe specific character widths are locale-specific.\nExamples are given for en-US.

\n\n
KeyValue\n \n

A key value pair.\nUsually used to represent the key value pairs from a Map or Object.

\n\n
LocationChangeEvent\n \n

A serializable version of the event from onPopState or onHashChange

\n\n
LocationChangeListener\n \n \n
NumberFormatStyle\n \n

Format styles that can be used to represent numbers.

\n\n
NumberSymbol\n \n

Symbols that can be used to replace placeholders in number patterns.\nExamples are based on en-US values.

\n\n
Plural\n \n

Plurality cases used for translating plurals to different languages.

\n\n
PopStateEvent\n \n \n
TranslationWidth\n \n

String widths available for translations.\nThe specific character widths are locale-specific.\nExamples are given for the word \"Sunday\" in English.

\n\n
WeekDay\n \n

The value for each day of the week, based on the en-US locale

\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
NgClass\n \n

Adds and removes CSS classes on an HTML element.

\n\n
NgComponentOutlet\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
NgForOf\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
NgIf\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
NgPlural\n \n

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

\n\n
NgPluralCase\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
NgStyle\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
NgSwitch\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
NgSwitchCase\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
NgSwitchDefault\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
NgTemplateOutlet\n \n

Inserts an embedded view from a prepared TemplateRef.

\n\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
AsyncPipe\n \n

Unwraps a value from an asynchronous primitive.

\n\n
CurrencyPipe\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
DatePipe\n \n

Formats a date value according to locale rules.

\n\n
DecimalPipe\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
I18nPluralPipe\n \n

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

\n\n
I18nSelectPipe\n \n

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

\n\n
JsonPipe\n \n

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

\n\n
KeyValuePipe\n \n

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

\n\n
LowerCasePipe\n \n

Transforms text to all lower case.

\n\n
PercentPipe\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
SlicePipe\n \n

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

\n\n
TitleCasePipe\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
UpperCasePipe\n \n

Transforms text to all upper case.

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

Typeslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
APP_BASE_HREF\n \n

A predefined DI token for the base href\nto be used with the PathLocationStrategy.\nThe base href is the URL prefix that should be preserved when generating\nand recognizing URLs.

\n\n
DOCUMENT\n \n

A DI Token representing the main rendering context. In a browser this is the DOM Document.

\n\n
LOCATION_INITIALIZED\n \n

Indicates when a location is initialized.

\n\n
Time\n \n

Represents a time value with hours and minutes.

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