填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

@angular/common

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

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.

入口點

主要

@angular/common

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

次要

@angular/common/http

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

@angular/common/http/testing

Supplies a testing module for the Angular HTTP subsystem.

@angular/common/testing

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

@angular/common/upgrade

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

主入口點的匯出

模組

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.

類別

HashLocationStrategy

LocationStrategy用來配置 Location服務,以便在瀏覽器 URL 的 hash 片段中表示其狀態。

A LocationStrategyused to configure the Locationservice to represent its state in the hash fragment of the browser's URL.

Location

一個服務,應用可以用它來與瀏覽器的 URL 互動。

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

LocationStrategy

使 Location 服務能夠從瀏覽器的 URL 讀取路由狀態。 Angular 提供了兩種策略: HashLocationStrategyPathLocationStrategy

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

NgForOfContext
NgIfContext
NgLocaleLocalization

根據語言環境返回複數形式

Returns the plural case based on the locale

NgLocalization
PathLocationStrategy

LocationStrategy用來配置 Location服務,以便在瀏覽器 URL 的 path 中表示其狀態。

A LocationStrategyused to configure the Locationservice to represent its state in the path of the browser's URL.

PlatformLocation

此類別不應由應用程式開發人員直接使用。而應使用 Location

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

ViewportScroller

定義滾動位置管理器。由 BrowserViewportScroller 實現。

Defines a scroll position manager. Implemented by BrowserViewportScroller.

函式

formatCurrency

使用區域設定規則將數字格式化為貨幣。

Formats a number as currency using locale rules.

formatDate

基於區域規則格式化日期。

Formats a date according to locale rules.

formatNumber

將數字格式化為文字格式,並根據區域來設定組大小、分隔符和其他引數。

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

formatPercent

根據語言環境規則將數字格式化為百分比。

Formats a number as a percentage according to locale rules.

getCurrencySymbol

檢索給定貨幣程式碼的貨幣符號。

Retrieves the currency symbol for a given currency code.

getLocaleCurrencyCode

檢索給定語言環境的預設貨幣程式碼。

Retrieves the default currency code for the given locale.

getLocaleCurrencyName

檢索與給定語言環境相對應的主要國家/地區的貨幣名稱。對於 en-US 是 “US Dollar”。

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

getLocaleCurrencySymbol

檢索用於表示與給定語言環境對應的主要國家/地區的貨幣的符號。對於 en-US$

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

getLocaleDateFormat

檢索本地化的日期-值格式字串。

Retrieves a localized date-value formating string.

getLocaleDateTimeFormat

檢索本地化的日期時間格式字串。

Retrieves a localized date-time formatting string.

getLocaleDayNames

使用公曆來檢索給定語言環境下的星期幾。

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

getLocaleDayPeriods

檢索給定語言環境的一天時段字串。

Retrieves day period strings for the given locale.

getLocaleDirection

檢索指定語言環境的書寫方向

Retrieves the writing direction of a specified locale

getLocaleEraNames

檢索給定語言環境的格里高利曆日曆。

Retrieves Gregorian-calendar eras for the given locale.

getLocaleExtraDayPeriodRules

檢索特定於語言環境的規則,該規則用於確定在為一個語言環境中定義了多個時段時要使用的一天時段。

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

getLocaleExtraDayPeriods

檢索特定於語言環境的一天時段,該時段大致指示如何用不同的語言分解一天。例如,對於 en-US,這些時段為 morning、noon、afternoon、evening 和 midnight。

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

getLocaleFirstDayOfWeek

檢索給定語言環境中一週的第一天。

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

getLocaleId

從當前已載入的語言環境中檢索語言環境 ID。載入的語言環境也可能是全球語言環境,而不是區域性語言環境。

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

getLocaleMonthNames

使用公曆來檢索給定語言環境下一年中的月份。

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

getLocaleNumberFormat

檢索給定語言環境下的數字格式。

Retrieves a number format for a given locale.

getLocaleNumberSymbol

檢索本地化的數字符號,該符號可用於替換數字格式的佔位符。

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

getLocalePluralCase

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

getLocaleTimeFormat

檢索本地化的時間值格式字串。

Retrieves a localized time-value formatting string.

getLocaleWeekEndRange

在給定語言環境中被視為週末的工作日範圍。

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

getNumberOfCurrencyDigits

報告給定貨幣的小數位數。其值取決於該特定貨幣中分幣是否存在。

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

isPlatformBrowser

返回平臺 ID 是否代表瀏覽器平臺。

Returns whether a platform id represents a browser platform.

isPlatformServer

返回平臺 ID 是否代表伺服器平臺。

Returns whether a platform id represents a server platform.

isPlatformWorkerApp

返回平臺 ID 是否代表 Web Worker 應用平臺。

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

isPlatformWorkerUi

返回平臺 ID 是否代表 Web Worker UI 平臺。

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

registerLocaleData

註冊全域性資料以供 Angular 內部使用。請參閱 “I18n 指南”以瞭解如何匯入其他語言環境的資料。

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

結構

FormStyle

字串的上下文相關翻譯形式。通常,獨立版本用於單詞的主格形式,格式化的版本則用於所有格。

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

FormatWidth

可用於日期時間格式的字串寬度。特定的字元寬度是特定於語言環境的。示例中是給 en-US 的示例。

String widths available for date-time formats. The specific character widths are locale-specific. Examples are given for en-US.

KeyValue

一個鍵值對。通常用於表示 Map 或 Object 中的鍵值對。

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

LocationChangeEvent

來自 onPopStateonHashChange 的事件的可序列化版本

A serializable version of the event from onPopState or onHashChange

LocationChangeListener
NumberFormatStyle

可用來表示數字的格式化樣式。

Format styles that can be used to represent numbers.

NumberSymbol

可用於替換數字模式中佔位符的符號。例如基於 en-US 的值。

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

Plural

用於將複數形式轉換為不同語言的複數形式。

Plurality cases used for translating plurals to different languages.

PopStateEvent
TranslationWidth

字串寬度可用於翻譯。特定的字元寬度是特定於語言環境的。這裡給出了英語中 “Sunday” 一詞的示例。

String widths available for translations. The specific character widths are locale-specific. Examples are given for the word "Sunday" in English.

WeekDay

一週中每一天的值(基於 en-US 語言環境)

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

指令

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

把數字轉換成字串, 根據本地化規則進行格式化,這些規則會決定分組大小和分組分隔符、小數點字元以及其它與本地化環境有關的配置項。

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.

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.

型別

APP_BASE_HREF

預定義的 DI 令牌,用於和 PathLocationStrategy 一起使用的 base href。base href 是在產生和識別 URL 時應保留的 URL 字首。

A predefined DI token for the base href to be used with the PathLocationStrategy. The base href is the URL prefix that should be preserved when generating and recognizing URLs.

DOCUMENT

表示主要渲染上下文的 DI 令牌。在瀏覽器中,這是 DOM 文件。

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

LOCATION_INITIALIZED

指示何時初始化 location。

Indicates when a location is initialized.

Time

用小時和分鐘表示的時間值。

Represents a time value with hours and minutes.