1 | /**
|
---|
2 | * @license Angular v12.2.9
|
---|
3 | * (c) 2010-2021 Google LLC. https://angular.io/
|
---|
4 | * License: MIT
|
---|
5 | */
|
---|
6 |
|
---|
7 | import { ChangeDetectorRef } from '@angular/core';
|
---|
8 | import { DoCheck } from '@angular/core';
|
---|
9 | import { ElementRef } from '@angular/core';
|
---|
10 | import { InjectionToken } from '@angular/core';
|
---|
11 | import { Injector } from '@angular/core';
|
---|
12 | import { IterableDiffers } from '@angular/core';
|
---|
13 | import { KeyValueDiffers } from '@angular/core';
|
---|
14 | import { NgIterable } from '@angular/core';
|
---|
15 | import { NgModuleFactory } from '@angular/core';
|
---|
16 | import { Observable } from 'rxjs';
|
---|
17 | import { OnChanges } from '@angular/core';
|
---|
18 | import { OnDestroy } from '@angular/core';
|
---|
19 | import { PipeTransform } from '@angular/core';
|
---|
20 | import { Provider } from '@angular/core';
|
---|
21 | import { Renderer2 } from '@angular/core';
|
---|
22 | import { SimpleChanges } from '@angular/core';
|
---|
23 | import { Subscribable } from 'rxjs';
|
---|
24 | import { SubscriptionLike } from 'rxjs';
|
---|
25 | import { TemplateRef } from '@angular/core';
|
---|
26 | import { TrackByFunction } from '@angular/core';
|
---|
27 | import { Type } from '@angular/core';
|
---|
28 | import { Version } from '@angular/core';
|
---|
29 | import { ViewContainerRef } from '@angular/core';
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * A predefined [DI token](guide/glossary#di-token) for the base href
|
---|
33 | * to be used with the `PathLocationStrategy`.
|
---|
34 | * The base href is the URL prefix that should be preserved when generating
|
---|
35 | * and recognizing URLs.
|
---|
36 | *
|
---|
37 | * @usageNotes
|
---|
38 | *
|
---|
39 | * The following example shows how to use this token to configure the root app injector
|
---|
40 | * with a base href value, so that the DI framework can supply the dependency anywhere in the app.
|
---|
41 | *
|
---|
42 | * ```typescript
|
---|
43 | * import {Component, NgModule} from '@angular/core';
|
---|
44 | * import {APP_BASE_HREF} from '@angular/common';
|
---|
45 | *
|
---|
46 | * @NgModule({
|
---|
47 | * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
|
---|
48 | * })
|
---|
49 | * class AppModule {}
|
---|
50 | * ```
|
---|
51 | *
|
---|
52 | * @publicApi
|
---|
53 | */
|
---|
54 | export declare const APP_BASE_HREF: InjectionToken<string>;
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * @ngModule CommonModule
|
---|
58 | * @description
|
---|
59 | *
|
---|
60 | * Unwraps a value from an asynchronous primitive.
|
---|
61 | *
|
---|
62 | * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
|
---|
63 | * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
|
---|
64 | * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
|
---|
65 | * potential memory leaks.
|
---|
66 | *
|
---|
67 | * @usageNotes
|
---|
68 | *
|
---|
69 | * ### Examples
|
---|
70 | *
|
---|
71 | * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
|
---|
72 | * promise.
|
---|
73 | *
|
---|
74 | * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
|
---|
75 | *
|
---|
76 | * It's also possible to use `async` with Observables. The example below binds the `time` Observable
|
---|
77 | * to the view. The Observable continuously updates the view with the current time.
|
---|
78 | *
|
---|
79 | * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
|
---|
80 | *
|
---|
81 | * @publicApi
|
---|
82 | */
|
---|
83 | export declare class AsyncPipe implements OnDestroy, PipeTransform {
|
---|
84 | private _ref;
|
---|
85 | private _latestValue;
|
---|
86 | private _subscription;
|
---|
87 | private _obj;
|
---|
88 | private _strategy;
|
---|
89 | constructor(_ref: ChangeDetectorRef);
|
---|
90 | ngOnDestroy(): void;
|
---|
91 | transform<T>(obj: Observable<T> | Subscribable<T> | Promise<T>): T | null;
|
---|
92 | transform<T>(obj: null | undefined): null;
|
---|
93 | transform<T>(obj: Observable<T> | Subscribable<T> | Promise<T> | null | undefined): T | null;
|
---|
94 | private _subscribe;
|
---|
95 | private _selectStrategy;
|
---|
96 | private _dispose;
|
---|
97 | private _updateLatestValue;
|
---|
98 | }
|
---|
99 |
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Exports all the basic Angular directives and pipes,
|
---|
103 | * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.
|
---|
104 | * Re-exported by `BrowserModule`, which is included automatically in the root
|
---|
105 | * `AppModule` when you create a new app with the CLI `new` command.
|
---|
106 | *
|
---|
107 | * * The `providers` options configure the NgModule's injector to provide
|
---|
108 | * localization dependencies to members.
|
---|
109 | * * The `exports` options make the declared directives and pipes available for import
|
---|
110 | * by other NgModules.
|
---|
111 | *
|
---|
112 | * @publicApi
|
---|
113 | */
|
---|
114 | export declare class CommonModule {
|
---|
115 | }
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * @ngModule CommonModule
|
---|
119 | * @description
|
---|
120 | *
|
---|
121 | * Transforms a number to a currency string, formatted according to locale rules
|
---|
122 | * that determine group sizing and separator, decimal-point character,
|
---|
123 | * and other locale-specific configurations.
|
---|
124 | *
|
---|
125 | * {@a currency-code-deprecation}
|
---|
126 | * <div class="alert is-helpful">
|
---|
127 | *
|
---|
128 | * **Deprecation notice:**
|
---|
129 | *
|
---|
130 | * The default currency code is currently always `USD` but this is deprecated from v9.
|
---|
131 | *
|
---|
132 | * **In v11 the default currency code will be taken from the current locale identified by
|
---|
133 | * the `LOCALE_ID` token. See the [i18n guide](guide/i18n-common-locale-id) for
|
---|
134 | * more information.**
|
---|
135 | *
|
---|
136 | * If you need the previous behavior then set it by creating a `DEFAULT_CURRENCY_CODE` provider in
|
---|
137 | * your application `NgModule`:
|
---|
138 | *
|
---|
139 | * ```ts
|
---|
140 | * {provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}
|
---|
141 | * ```
|
---|
142 | *
|
---|
143 | * </div>
|
---|
144 | *
|
---|
145 | * @see `getCurrencySymbol()`
|
---|
146 | * @see `formatCurrency()`
|
---|
147 | *
|
---|
148 | * @usageNotes
|
---|
149 | * The following code shows how the pipe transforms numbers
|
---|
150 | * into text strings, according to various format specifications,
|
---|
151 | * where the caller's default locale is `en-US`.
|
---|
152 | *
|
---|
153 | * <code-example path="common/pipes/ts/currency_pipe.ts" region='CurrencyPipe'></code-example>
|
---|
154 | *
|
---|
155 | * @publicApi
|
---|
156 | */
|
---|
157 | export declare class CurrencyPipe implements PipeTransform {
|
---|
158 | private _locale;
|
---|
159 | private _defaultCurrencyCode;
|
---|
160 | constructor(_locale: string, _defaultCurrencyCode?: string);
|
---|
161 | transform(value: number | string, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
|
---|
162 | transform(value: null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): null;
|
---|
163 | transform(value: number | string | null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
|
---|
164 | }
|
---|
165 |
|
---|
166 | /**
|
---|
167 | * @ngModule CommonModule
|
---|
168 | * @description
|
---|
169 | *
|
---|
170 | * Formats a date value according to locale rules.
|
---|
171 | *
|
---|
172 | * `DatePipe` is executed only when it detects a pure change to the input value.
|
---|
173 | * A pure change is either a change to a primitive input value
|
---|
174 | * (such as `String`, `Number`, `Boolean`, or `Symbol`),
|
---|
175 | * or a changed object reference (such as `Date`, `Array`, `Function`, or `Object`).
|
---|
176 | *
|
---|
177 | * Note that mutating a `Date` object does not cause the pipe to be rendered again.
|
---|
178 | * To ensure that the pipe is executed, you must create a new `Date` object.
|
---|
179 | *
|
---|
180 | * Only the `en-US` locale data comes with Angular. To localize dates
|
---|
181 | * in another language, you must import the corresponding locale data.
|
---|
182 | * See the [I18n guide](guide/i18n-common-format-data-locale) for more information.
|
---|
183 | *
|
---|
184 | * @see `formatDate()`
|
---|
185 | *
|
---|
186 | *
|
---|
187 | * @usageNotes
|
---|
188 | *
|
---|
189 | * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to
|
---|
190 | * reformat the date on every change-detection cycle, treat the date as an immutable object
|
---|
191 | * and change the reference when the pipe needs to run again.
|
---|
192 | *
|
---|
193 | * ### Pre-defined format options
|
---|
194 | *
|
---|
195 | * | Option | Equivalent to | Examples (given in `en-US` locale) |
|
---|
196 | * |---------------|-------------------------------------|-------------------------------------------------|
|
---|
197 | * | `'short'` | `'M/d/yy, h:mm a'` | `6/15/15, 9:03 AM` |
|
---|
198 | * | `'medium'` | `'MMM d, y, h:mm:ss a'` | `Jun 15, 2015, 9:03:01 AM` |
|
---|
199 | * | `'long'` | `'MMMM d, y, h:mm:ss a z'` | `June 15, 2015 at 9:03:01 AM GMT+1` |
|
---|
200 | * | `'full'` | `'EEEE, MMMM d, y, h:mm:ss a zzzz'` | `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00` |
|
---|
201 | * | `'shortDate'` | `'M/d/yy'` | `6/15/15` |
|
---|
202 | * | `'mediumDate'`| `'MMM d, y'` | `Jun 15, 2015` |
|
---|
203 | * | `'longDate'` | `'MMMM d, y'` | `June 15, 2015` |
|
---|
204 | * | `'fullDate'` | `'EEEE, MMMM d, y'` | `Monday, June 15, 2015` |
|
---|
205 | * | `'shortTime'` | `'h:mm a'` | `9:03 AM` |
|
---|
206 | * | `'mediumTime'`| `'h:mm:ss a'` | `9:03:01 AM` |
|
---|
207 | * | `'longTime'` | `'h:mm:ss a z'` | `9:03:01 AM GMT+1` |
|
---|
208 | * | `'fullTime'` | `'h:mm:ss a zzzz'` | `9:03:01 AM GMT+01:00` |
|
---|
209 | *
|
---|
210 | * ### Custom format options
|
---|
211 | *
|
---|
212 | * You can construct a format string using symbols to specify the components
|
---|
213 | * of a date-time value, as described in the following table.
|
---|
214 | * Format details depend on the locale.
|
---|
215 | * Fields marked with (*) are only available in the extra data set for the given locale.
|
---|
216 | *
|
---|
217 | * | Field type | Format | Description | Example Value |
|
---|
218 | * |-------------------- |-------------|---------------------------------------------------------------|------------------------------------------------------------|
|
---|
219 | * | Era | G, GG & GGG | Abbreviated | AD |
|
---|
220 | * | | GGGG | Wide | Anno Domini |
|
---|
221 | * | | GGGGG | Narrow | A |
|
---|
222 | * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
|
---|
223 | * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
|
---|
224 | * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
|
---|
225 | * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
|
---|
226 | * | Week-numbering year | Y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
|
---|
227 | * | | YY | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
|
---|
228 | * | | YYY | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
|
---|
229 | * | | YYYY | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
|
---|
230 | * | Month | M | Numeric: 1 digit | 9, 12 |
|
---|
231 | * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
|
---|
232 | * | | MMM | Abbreviated | Sep |
|
---|
233 | * | | MMMM | Wide | September |
|
---|
234 | * | | MMMMM | Narrow | S |
|
---|
235 | * | Month standalone | L | Numeric: 1 digit | 9, 12 |
|
---|
236 | * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
|
---|
237 | * | | LLL | Abbreviated | Sep |
|
---|
238 | * | | LLLL | Wide | September |
|
---|
239 | * | | LLLLL | Narrow | S |
|
---|
240 | * | Week of year | w | Numeric: minimum digits | 1... 53 |
|
---|
241 | * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
|
---|
242 | * | Week of month | W | Numeric: 1 digit | 1... 5 |
|
---|
243 | * | Day of month | d | Numeric: minimum digits | 1 |
|
---|
244 | * | | dd | Numeric: 2 digits + zero padded | 01 |
|
---|
245 | * | Week day | E, EE & EEE | Abbreviated | Tue |
|
---|
246 | * | | EEEE | Wide | Tuesday |
|
---|
247 | * | | EEEEE | Narrow | T |
|
---|
248 | * | | EEEEEE | Short | Tu |
|
---|
249 | * | Week day standalone | c, cc | Numeric: 1 digit | 2 |
|
---|
250 | * | | ccc | Abbreviated | Tue |
|
---|
251 | * | | cccc | Wide | Tuesday |
|
---|
252 | * | | ccccc | Narrow | T |
|
---|
253 | * | | cccccc | Short | Tu |
|
---|
254 | * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
|
---|
255 | * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
|
---|
256 | * | | aaaaa | Narrow | a/p |
|
---|
257 | * | Period* | B, BB & BBB | Abbreviated | mid. |
|
---|
258 | * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
|
---|
259 | * | | BBBBB | Narrow | md |
|
---|
260 | * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
|
---|
261 | * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
|
---|
262 | * | | bbbbb | Narrow | md |
|
---|
263 | * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
|
---|
264 | * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
|
---|
265 | * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
|
---|
266 | * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
|
---|
267 | * | Minute | m | Numeric: minimum digits | 8, 59 |
|
---|
268 | * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
|
---|
269 | * | Second | s | Numeric: minimum digits | 0... 59 |
|
---|
270 | * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
|
---|
271 | * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
|
---|
272 | * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
|
---|
273 | * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
|
---|
274 | * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
|
---|
275 | * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
|
---|
276 | * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
|
---|
277 | * | | ZZZZ | Long localized GMT format | GMT-8:00 |
|
---|
278 | * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
|
---|
279 | * | | O, OO & OOO | Short localized GMT format | GMT-8 |
|
---|
280 | * | | OOOO | Long localized GMT format | GMT-08:00 |
|
---|
281 | *
|
---|
282 | *
|
---|
283 | * ### Format examples
|
---|
284 | *
|
---|
285 | * These examples transform a date into various formats,
|
---|
286 | * assuming that `dateObj` is a JavaScript `Date` object for
|
---|
287 | * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,
|
---|
288 | * given in the local time for the `en-US` locale.
|
---|
289 | *
|
---|
290 | * ```
|
---|
291 | * {{ dateObj | date }} // output is 'Jun 15, 2015'
|
---|
292 | * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
|
---|
293 | * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'
|
---|
294 | * {{ dateObj | date:'mm:ss' }} // output is '43:11'
|
---|
295 | * ```
|
---|
296 | *
|
---|
297 | * ### Usage example
|
---|
298 | *
|
---|
299 | * The following component uses a date pipe to display the current date in different formats.
|
---|
300 | *
|
---|
301 | * ```
|
---|
302 | * @Component({
|
---|
303 | * selector: 'date-pipe',
|
---|
304 | * template: `<div>
|
---|
305 | * <p>Today is {{today | date}}</p>
|
---|
306 | * <p>Or if you prefer, {{today | date:'fullDate'}}</p>
|
---|
307 | * <p>The time is {{today | date:'h:mm a z'}}</p>
|
---|
308 | * </div>`
|
---|
309 | * })
|
---|
310 | * // Get the current date and time as a date-time value.
|
---|
311 | * export class DatePipeComponent {
|
---|
312 | * today: number = Date.now();
|
---|
313 | * }
|
---|
314 | * ```
|
---|
315 | *
|
---|
316 | * @publicApi
|
---|
317 | */
|
---|
318 | export declare class DatePipe implements PipeTransform {
|
---|
319 | private locale;
|
---|
320 | constructor(locale: string);
|
---|
321 | /**
|
---|
322 | * @param value The date expression: a `Date` object, a number
|
---|
323 | * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
|
---|
324 | * @param format The date/time components to include, using predefined options or a
|
---|
325 | * custom format string.
|
---|
326 | * @param timezone A timezone offset (such as `'+0430'`), or a standard
|
---|
327 | * UTC/GMT or continental US timezone abbreviation.
|
---|
328 | * When not supplied, uses the end-user's local system timezone.
|
---|
329 | * @param locale A locale code for the locale format rules to use.
|
---|
330 | * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
|
---|
331 | * See [Setting your app locale](guide/i18n-common-locale-id).
|
---|
332 | * @returns A date string in the desired format.
|
---|
333 | */
|
---|
334 | transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
|
---|
335 | transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
|
---|
336 | transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
|
---|
337 | }
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * @ngModule CommonModule
|
---|
341 | * @description
|
---|
342 | *
|
---|
343 | * Formats a value according to digit options and locale rules.
|
---|
344 | * Locale determines group sizing and separator,
|
---|
345 | * decimal point character, and other locale-specific configurations.
|
---|
346 | *
|
---|
347 | * @see `formatNumber()`
|
---|
348 | *
|
---|
349 | * @usageNotes
|
---|
350 | *
|
---|
351 | * ### digitsInfo
|
---|
352 | *
|
---|
353 | * The value's decimal representation is specified by the `digitsInfo`
|
---|
354 | * parameter, written in the following format:<br>
|
---|
355 | *
|
---|
356 | * ```
|
---|
357 | * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
|
---|
358 | * ```
|
---|
359 | *
|
---|
360 | * - `minIntegerDigits`:
|
---|
361 | * The minimum number of integer digits before the decimal point.
|
---|
362 | * Default is 1.
|
---|
363 | *
|
---|
364 | * - `minFractionDigits`:
|
---|
365 | * The minimum number of digits after the decimal point.
|
---|
366 | * Default is 0.
|
---|
367 | *
|
---|
368 | * - `maxFractionDigits`:
|
---|
369 | * The maximum number of digits after the decimal point.
|
---|
370 | * Default is 3.
|
---|
371 | *
|
---|
372 | * If the formatted value is truncated it will be rounded using the "to-nearest" method:
|
---|
373 | *
|
---|
374 | * ```
|
---|
375 | * {{3.6 | number: '1.0-0'}}
|
---|
376 | * <!--will output '4'-->
|
---|
377 | *
|
---|
378 | * {{-3.6 | number:'1.0-0'}}
|
---|
379 | * <!--will output '-4'-->
|
---|
380 | * ```
|
---|
381 | *
|
---|
382 | * ### locale
|
---|
383 | *
|
---|
384 | * `locale` will format a value according to locale rules.
|
---|
385 | * Locale determines group sizing and separator,
|
---|
386 | * decimal point character, and other locale-specific configurations.
|
---|
387 | *
|
---|
388 | * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
|
---|
389 | *
|
---|
390 | * See [Setting your app locale](guide/i18n-common-locale-id).
|
---|
391 | *
|
---|
392 | * ### Example
|
---|
393 | *
|
---|
394 | * The following code shows how the pipe transforms values
|
---|
395 | * according to various format specifications,
|
---|
396 | * where the caller's default locale is `en-US`.
|
---|
397 | *
|
---|
398 | * <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example>
|
---|
399 | *
|
---|
400 | * @publicApi
|
---|
401 | */
|
---|
402 | export declare class DecimalPipe implements PipeTransform {
|
---|
403 | private _locale;
|
---|
404 | constructor(_locale: string);
|
---|
405 | transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
|
---|
406 | transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
|
---|
407 | transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
|
---|
408 | }
|
---|
409 |
|
---|
410 | /**
|
---|
411 | * A DI Token representing the main rendering context. In a browser this is the DOM Document.
|
---|
412 | *
|
---|
413 | * Note: Document might not be available in the Application Context when Application and Rendering
|
---|
414 | * Contexts are not the same (e.g. when running the application in a Web Worker).
|
---|
415 | *
|
---|
416 | * @publicApi
|
---|
417 | */
|
---|
418 | export declare const DOCUMENT: InjectionToken<Document>;
|
---|
419 |
|
---|
420 | /**
|
---|
421 | * @ngModule CommonModule
|
---|
422 | * @description
|
---|
423 | *
|
---|
424 | * Formats a number as currency using locale rules.
|
---|
425 | *
|
---|
426 | * @param value The number to format.
|
---|
427 | * @param locale A locale code for the locale format rules to use.
|
---|
428 | * @param currency A string containing the currency symbol or its name,
|
---|
429 | * such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation
|
---|
430 | * of the function.
|
---|
431 | * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
|
---|
432 | * currency code, such as `USD` for the US dollar and `EUR` for the euro.
|
---|
433 | * Used to determine the number of digits in the decimal part.
|
---|
434 | * @param digitsInfo Decimal representation options, specified by a string in the following format:
|
---|
435 | * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
|
---|
436 | *
|
---|
437 | * @returns The formatted currency value.
|
---|
438 | *
|
---|
439 | * @see `formatNumber()`
|
---|
440 | * @see `DecimalPipe`
|
---|
441 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
442 | *
|
---|
443 | * @publicApi
|
---|
444 | */
|
---|
445 | export declare function formatCurrency(value: number, locale: string, currency: string, currencyCode?: string, digitsInfo?: string): string;
|
---|
446 |
|
---|
447 | /**
|
---|
448 | * @ngModule CommonModule
|
---|
449 | * @description
|
---|
450 | *
|
---|
451 | * Formats a date according to locale rules.
|
---|
452 | *
|
---|
453 | * @param value The date to format, as a Date, or a number (milliseconds since UTC epoch)
|
---|
454 | * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime).
|
---|
455 | * @param format The date-time components to include. See `DatePipe` for details.
|
---|
456 | * @param locale A locale code for the locale format rules to use.
|
---|
457 | * @param timezone The time zone. A time zone offset from GMT (such as `'+0430'`),
|
---|
458 | * or a standard UTC/GMT or continental US time zone abbreviation.
|
---|
459 | * If not specified, uses host system settings.
|
---|
460 | *
|
---|
461 | * @returns The formatted date string.
|
---|
462 | *
|
---|
463 | * @see `DatePipe`
|
---|
464 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
465 | *
|
---|
466 | * @publicApi
|
---|
467 | */
|
---|
468 | export declare function formatDate(value: string | number | Date, format: string, locale: string, timezone?: string): string;
|
---|
469 |
|
---|
470 | /**
|
---|
471 | * @ngModule CommonModule
|
---|
472 | * @description
|
---|
473 | *
|
---|
474 | * Formats a number as text, with group sizing, separator, and other
|
---|
475 | * parameters based on the locale.
|
---|
476 | *
|
---|
477 | * @param value The number to format.
|
---|
478 | * @param locale A locale code for the locale format rules to use.
|
---|
479 | * @param digitsInfo Decimal representation options, specified by a string in the following format:
|
---|
480 | * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
|
---|
481 | *
|
---|
482 | * @returns The formatted text string.
|
---|
483 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
484 | *
|
---|
485 | * @publicApi
|
---|
486 | */
|
---|
487 | export declare function formatNumber(value: number, locale: string, digitsInfo?: string): string;
|
---|
488 |
|
---|
489 | /**
|
---|
490 | * @ngModule CommonModule
|
---|
491 | * @description
|
---|
492 | *
|
---|
493 | * Formats a number as a percentage according to locale rules.
|
---|
494 | *
|
---|
495 | * @param value The number to format.
|
---|
496 | * @param locale A locale code for the locale format rules to use.
|
---|
497 | * @param digitsInfo Decimal representation options, specified by a string in the following format:
|
---|
498 | * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
|
---|
499 | *
|
---|
500 | * @returns The formatted percentage value.
|
---|
501 | *
|
---|
502 | * @see `formatNumber()`
|
---|
503 | * @see `DecimalPipe`
|
---|
504 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
505 | * @publicApi
|
---|
506 | *
|
---|
507 | */
|
---|
508 | export declare function formatPercent(value: number, locale: string, digitsInfo?: string): string;
|
---|
509 |
|
---|
510 | /**
|
---|
511 | * String widths available for date-time formats.
|
---|
512 | * The specific character widths are locale-specific.
|
---|
513 | * Examples are given for `en-US`.
|
---|
514 | *
|
---|
515 | * @see `getLocaleDateFormat()`
|
---|
516 | * @see `getLocaleTimeFormat()`
|
---|
517 | * @see `getLocaleDateTimeFormat()`
|
---|
518 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
519 | * @publicApi
|
---|
520 | */
|
---|
521 | export declare enum FormatWidth {
|
---|
522 | /**
|
---|
523 | * For `en-US`, 'M/d/yy, h:mm a'`
|
---|
524 | * (Example: `6/15/15, 9:03 AM`)
|
---|
525 | */
|
---|
526 | Short = 0,
|
---|
527 | /**
|
---|
528 | * For `en-US`, `'MMM d, y, h:mm:ss a'`
|
---|
529 | * (Example: `Jun 15, 2015, 9:03:01 AM`)
|
---|
530 | */
|
---|
531 | Medium = 1,
|
---|
532 | /**
|
---|
533 | * For `en-US`, `'MMMM d, y, h:mm:ss a z'`
|
---|
534 | * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`)
|
---|
535 | */
|
---|
536 | Long = 2,
|
---|
537 | /**
|
---|
538 | * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'`
|
---|
539 | * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`)
|
---|
540 | */
|
---|
541 | Full = 3
|
---|
542 | }
|
---|
543 |
|
---|
544 | /**
|
---|
545 | * Context-dependant translation forms for strings.
|
---|
546 | * Typically the standalone version is for the nominative form of the word,
|
---|
547 | * and the format version is used for the genitive case.
|
---|
548 | * @see [CLDR website](http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles)
|
---|
549 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
550 | *
|
---|
551 | * @publicApi
|
---|
552 | */
|
---|
553 | export declare enum FormStyle {
|
---|
554 | Format = 0,
|
---|
555 | Standalone = 1
|
---|
556 | }
|
---|
557 |
|
---|
558 | /**
|
---|
559 | * Retrieves the currency symbol for a given currency code.
|
---|
560 | *
|
---|
561 | * For example, for the default `en-US` locale, the code `USD` can
|
---|
562 | * be represented by the narrow symbol `$` or the wide symbol `US$`.
|
---|
563 | *
|
---|
564 | * @param code The currency code.
|
---|
565 | * @param format The format, `wide` or `narrow`.
|
---|
566 | * @param locale A locale code for the locale format rules to use.
|
---|
567 | *
|
---|
568 | * @returns The symbol, or the currency code if no symbol is available.
|
---|
569 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
570 | *
|
---|
571 | * @publicApi
|
---|
572 | */
|
---|
573 | export declare function getCurrencySymbol(code: string, format: 'wide' | 'narrow', locale?: string): string;
|
---|
574 |
|
---|
575 | /**
|
---|
576 | * Retrieves the default currency code for the given locale.
|
---|
577 | *
|
---|
578 | * The default is defined as the first currency which is still in use.
|
---|
579 | *
|
---|
580 | * @param locale The code of the locale whose currency code we want.
|
---|
581 | * @returns The code of the default currency for the given locale.
|
---|
582 | *
|
---|
583 | * @publicApi
|
---|
584 | */
|
---|
585 | export declare function getLocaleCurrencyCode(locale: string): string | null;
|
---|
586 |
|
---|
587 | /**
|
---|
588 | * Retrieves the name of the currency for the main country corresponding
|
---|
589 | * to a given locale. For example, 'US Dollar' for `en-US`.
|
---|
590 | * @param locale A locale code for the locale format rules to use.
|
---|
591 | * @returns The currency name,
|
---|
592 | * or `null` if the main country cannot be determined.
|
---|
593 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
594 | *
|
---|
595 | * @publicApi
|
---|
596 | */
|
---|
597 | export declare function getLocaleCurrencyName(locale: string): string | null;
|
---|
598 |
|
---|
599 | /**
|
---|
600 | * Retrieves the symbol used to represent the currency for the main country
|
---|
601 | * corresponding to a given locale. For example, '$' for `en-US`.
|
---|
602 | *
|
---|
603 | * @param locale A locale code for the locale format rules to use.
|
---|
604 | * @returns The localized symbol character,
|
---|
605 | * or `null` if the main country cannot be determined.
|
---|
606 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
607 | *
|
---|
608 | * @publicApi
|
---|
609 | */
|
---|
610 | export declare function getLocaleCurrencySymbol(locale: string): string | null;
|
---|
611 |
|
---|
612 | /**
|
---|
613 | * Retrieves a localized date-value formating string.
|
---|
614 | *
|
---|
615 | * @param locale A locale code for the locale format rules to use.
|
---|
616 | * @param width The format type.
|
---|
617 | * @returns The localized formating string.
|
---|
618 | * @see `FormatWidth`
|
---|
619 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
620 | *
|
---|
621 | * @publicApi
|
---|
622 | */
|
---|
623 | export declare function getLocaleDateFormat(locale: string, width: FormatWidth): string;
|
---|
624 |
|
---|
625 | /**
|
---|
626 | * Retrieves a localized date-time formatting string.
|
---|
627 | *
|
---|
628 | * @param locale A locale code for the locale format rules to use.
|
---|
629 | * @param width The format type.
|
---|
630 | * @returns The localized formatting string.
|
---|
631 | * @see `FormatWidth`
|
---|
632 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
633 | *
|
---|
634 | * @publicApi
|
---|
635 | */
|
---|
636 | export declare function getLocaleDateTimeFormat(locale: string, width: FormatWidth): string;
|
---|
637 |
|
---|
638 | /**
|
---|
639 | * Retrieves days of the week for the given locale, using the Gregorian calendar.
|
---|
640 | *
|
---|
641 | * @param locale A locale code for the locale format rules to use.
|
---|
642 | * @param formStyle The required grammatical form.
|
---|
643 | * @param width The required character width.
|
---|
644 | * @returns An array of localized name strings.
|
---|
645 | * For example,`[Sunday, Monday, ... Saturday]` for `en-US`.
|
---|
646 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
647 | *
|
---|
648 | * @publicApi
|
---|
649 | */
|
---|
650 | export declare function getLocaleDayNames(locale: string, formStyle: FormStyle, width: TranslationWidth): ReadonlyArray<string>;
|
---|
651 |
|
---|
652 | /**
|
---|
653 | * Retrieves day period strings for the given locale.
|
---|
654 | *
|
---|
655 | * @param locale A locale code for the locale format rules to use.
|
---|
656 | * @param formStyle The required grammatical form.
|
---|
657 | * @param width The required character width.
|
---|
658 | * @returns An array of localized period strings. For example, `[AM, PM]` for `en-US`.
|
---|
659 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
660 | *
|
---|
661 | * @publicApi
|
---|
662 | */
|
---|
663 | export declare function getLocaleDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): Readonly<[string, string]>;
|
---|
664 |
|
---|
665 | /**
|
---|
666 | * Retrieves the writing direction of a specified locale
|
---|
667 | * @param locale A locale code for the locale format rules to use.
|
---|
668 | * @publicApi
|
---|
669 | * @returns 'rtl' or 'ltr'
|
---|
670 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
671 | */
|
---|
672 | export declare function getLocaleDirection(locale: string): 'ltr' | 'rtl';
|
---|
673 |
|
---|
674 | /**
|
---|
675 | * Retrieves Gregorian-calendar eras for the given locale.
|
---|
676 | * @param locale A locale code for the locale format rules to use.
|
---|
677 | * @param width The required character width.
|
---|
678 |
|
---|
679 | * @returns An array of localized era strings.
|
---|
680 | * For example, `[AD, BC]` for `en-US`.
|
---|
681 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
682 | *
|
---|
683 | * @publicApi
|
---|
684 | */
|
---|
685 | export declare function getLocaleEraNames(locale: string, width: TranslationWidth): Readonly<[string, string]>;
|
---|
686 |
|
---|
687 | /**
|
---|
688 | * Retrieves locale-specific rules used to determine which day period to use
|
---|
689 | * when more than one period is defined for a locale.
|
---|
690 | *
|
---|
691 | * There is a rule for each defined day period. The
|
---|
692 | * first rule is applied to the first day period and so on.
|
---|
693 | * Fall back to AM/PM when no rules are available.
|
---|
694 | *
|
---|
695 | * A rule can specify a period as time range, or as a single time value.
|
---|
696 | *
|
---|
697 | * This functionality is only available when you have loaded the full locale data.
|
---|
698 | * See the ["I18n guide"](guide/i18n-common-format-data-locale).
|
---|
699 | *
|
---|
700 | * @param locale A locale code for the locale format rules to use.
|
---|
701 | * @returns The rules for the locale, a single time value or array of *from-time, to-time*,
|
---|
702 | * or null if no periods are available.
|
---|
703 | *
|
---|
704 | * @see `getLocaleExtraDayPeriods()`
|
---|
705 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
706 | *
|
---|
707 | * @publicApi
|
---|
708 | */
|
---|
709 | export declare function getLocaleExtraDayPeriodRules(locale: string): (Time | [Time, Time])[];
|
---|
710 |
|
---|
711 | /**
|
---|
712 | * Retrieves locale-specific day periods, which indicate roughly how a day is broken up
|
---|
713 | * in different languages.
|
---|
714 | * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight.
|
---|
715 | *
|
---|
716 | * This functionality is only available when you have loaded the full locale data.
|
---|
717 | * See the ["I18n guide"](guide/i18n-common-format-data-locale).
|
---|
718 | *
|
---|
719 | * @param locale A locale code for the locale format rules to use.
|
---|
720 | * @param formStyle The required grammatical form.
|
---|
721 | * @param width The required character width.
|
---|
722 | * @returns The translated day-period strings.
|
---|
723 | * @see `getLocaleExtraDayPeriodRules()`
|
---|
724 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
725 | *
|
---|
726 | * @publicApi
|
---|
727 | */
|
---|
728 | export declare function getLocaleExtraDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): string[];
|
---|
729 |
|
---|
730 | /**
|
---|
731 | * Retrieves the first day of the week for the given locale.
|
---|
732 | *
|
---|
733 | * @param locale A locale code for the locale format rules to use.
|
---|
734 | * @returns A day index number, using the 0-based week-day index for `en-US`
|
---|
735 | * (Sunday = 0, Monday = 1, ...).
|
---|
736 | * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday.
|
---|
737 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
738 | *
|
---|
739 | * @publicApi
|
---|
740 | */
|
---|
741 | export declare function getLocaleFirstDayOfWeek(locale: string): WeekDay;
|
---|
742 |
|
---|
743 | /**
|
---|
744 | * Retrieves the locale ID from the currently loaded locale.
|
---|
745 | * The loaded locale could be, for example, a global one rather than a regional one.
|
---|
746 | * @param locale A locale code, such as `fr-FR`.
|
---|
747 | * @returns The locale code. For example, `fr`.
|
---|
748 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
749 | *
|
---|
750 | * @publicApi
|
---|
751 | */
|
---|
752 | export declare function getLocaleId(locale: string): string;
|
---|
753 |
|
---|
754 | /**
|
---|
755 | * Retrieves months of the year for the given locale, using the Gregorian calendar.
|
---|
756 | *
|
---|
757 | * @param locale A locale code for the locale format rules to use.
|
---|
758 | * @param formStyle The required grammatical form.
|
---|
759 | * @param width The required character width.
|
---|
760 | * @returns An array of localized name strings.
|
---|
761 | * For example, `[January, February, ...]` for `en-US`.
|
---|
762 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
763 | *
|
---|
764 | * @publicApi
|
---|
765 | */
|
---|
766 | export declare function getLocaleMonthNames(locale: string, formStyle: FormStyle, width: TranslationWidth): ReadonlyArray<string>;
|
---|
767 |
|
---|
768 | /**
|
---|
769 | * Retrieves a number format for a given locale.
|
---|
770 | *
|
---|
771 | * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
|
---|
772 | * when used to format the number 12345.678 could result in "12'345,678". That would happen if the
|
---|
773 | * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
|
---|
774 | *
|
---|
775 | * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders
|
---|
776 | * that stand for the decimal separator, and so on, and are NOT real characters.
|
---|
777 | * You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in
|
---|
778 | * your language the decimal point is written with a comma. The symbols should be replaced by the
|
---|
779 | * local equivalents, using the appropriate `NumberSymbol` for your language.
|
---|
780 | *
|
---|
781 | * Here are the special characters used in number patterns:
|
---|
782 | *
|
---|
783 | * | Symbol | Meaning |
|
---|
784 | * |--------|---------|
|
---|
785 | * | . | Replaced automatically by the character used for the decimal point. |
|
---|
786 | * | , | Replaced by the "grouping" (thousands) separator. |
|
---|
787 | * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
|
---|
788 | * | # | Replaced by a digit (or nothing if there aren't enough). |
|
---|
789 | * | ¤ | Replaced by a currency symbol, such as $ or USD. |
|
---|
790 | * | % | Marks a percent format. The % symbol may change position, but must be retained. |
|
---|
791 | * | E | Marks a scientific format. The E symbol may change position, but must be retained. |
|
---|
792 | * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
|
---|
793 | *
|
---|
794 | * @param locale A locale code for the locale format rules to use.
|
---|
795 | * @param type The type of numeric value to be formatted (such as `Decimal` or `Currency`.)
|
---|
796 | * @returns The localized format string.
|
---|
797 | * @see `NumberFormatStyle`
|
---|
798 | * @see [CLDR website](http://cldr.unicode.org/translation/number-patterns)
|
---|
799 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
800 | *
|
---|
801 | * @publicApi
|
---|
802 | */
|
---|
803 | export declare function getLocaleNumberFormat(locale: string, type: NumberFormatStyle): string;
|
---|
804 |
|
---|
805 | /**
|
---|
806 | * Retrieves a localized number symbol that can be used to replace placeholders in number formats.
|
---|
807 | * @param locale The locale code.
|
---|
808 | * @param symbol The symbol to localize.
|
---|
809 | * @returns The character for the localized symbol.
|
---|
810 | * @see `NumberSymbol`
|
---|
811 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
812 | *
|
---|
813 | * @publicApi
|
---|
814 | */
|
---|
815 | export declare function getLocaleNumberSymbol(locale: string, symbol: NumberSymbol): string;
|
---|
816 |
|
---|
817 | /**
|
---|
818 | * @alias core/ɵgetLocalePluralCase
|
---|
819 | * @publicApi
|
---|
820 | */
|
---|
821 | export declare const getLocalePluralCase: (locale: string) => ((value: number) => Plural);
|
---|
822 |
|
---|
823 | /**
|
---|
824 | * Retrieves a localized time-value formatting string.
|
---|
825 | *
|
---|
826 | * @param locale A locale code for the locale format rules to use.
|
---|
827 | * @param width The format type.
|
---|
828 | * @returns The localized formatting string.
|
---|
829 | * @see `FormatWidth`
|
---|
830 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
831 |
|
---|
832 | * @publicApi
|
---|
833 | */
|
---|
834 | export declare function getLocaleTimeFormat(locale: string, width: FormatWidth): string;
|
---|
835 |
|
---|
836 | /**
|
---|
837 | * Range of week days that are considered the week-end for the given locale.
|
---|
838 | *
|
---|
839 | * @param locale A locale code for the locale format rules to use.
|
---|
840 | * @returns The range of day values, `[startDay, endDay]`.
|
---|
841 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
842 | *
|
---|
843 | * @publicApi
|
---|
844 | */
|
---|
845 | export declare function getLocaleWeekEndRange(locale: string): [WeekDay, WeekDay];
|
---|
846 |
|
---|
847 | /**
|
---|
848 | * Reports the number of decimal digits for a given currency.
|
---|
849 | * The value depends upon the presence of cents in that particular currency.
|
---|
850 | *
|
---|
851 | * @param code The currency code.
|
---|
852 | * @returns The number of decimal digits, typically 0 or 2.
|
---|
853 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
854 | *
|
---|
855 | * @publicApi
|
---|
856 | */
|
---|
857 | export declare function getNumberOfCurrencyDigits(code: string): number;
|
---|
858 |
|
---|
859 | /**
|
---|
860 | * @description
|
---|
861 | * A {@link LocationStrategy} used to configure the {@link Location} service to
|
---|
862 | * represent its state in the
|
---|
863 | * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
|
---|
864 | * of the browser's URL.
|
---|
865 | *
|
---|
866 | * For instance, if you call `location.go('/foo')`, the browser's URL will become
|
---|
867 | * `example.com#/foo`.
|
---|
868 | *
|
---|
869 | * @usageNotes
|
---|
870 | *
|
---|
871 | * ### Example
|
---|
872 | *
|
---|
873 | * {@example common/location/ts/hash_location_component.ts region='LocationComponent'}
|
---|
874 | *
|
---|
875 | * @publicApi
|
---|
876 | */
|
---|
877 | export declare class HashLocationStrategy extends LocationStrategy implements OnDestroy {
|
---|
878 | private _platformLocation;
|
---|
879 | private _baseHref;
|
---|
880 | private _removeListenerFns;
|
---|
881 | constructor(_platformLocation: PlatformLocation, _baseHref?: string);
|
---|
882 | ngOnDestroy(): void;
|
---|
883 | onPopState(fn: LocationChangeListener): void;
|
---|
884 | getBaseHref(): string;
|
---|
885 | path(includeHash?: boolean): string;
|
---|
886 | prepareExternalUrl(internal: string): string;
|
---|
887 | pushState(state: any, title: string, path: string, queryParams: string): void;
|
---|
888 | replaceState(state: any, title: string, path: string, queryParams: string): void;
|
---|
889 | forward(): void;
|
---|
890 | back(): void;
|
---|
891 | historyGo(relativePosition?: number): void;
|
---|
892 | }
|
---|
893 |
|
---|
894 | /**
|
---|
895 | * @ngModule CommonModule
|
---|
896 | * @description
|
---|
897 | *
|
---|
898 | * Maps a value to a string that pluralizes the value according to locale rules.
|
---|
899 | *
|
---|
900 | * @usageNotes
|
---|
901 | *
|
---|
902 | * ### Example
|
---|
903 | *
|
---|
904 | * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
|
---|
905 | *
|
---|
906 | * @publicApi
|
---|
907 | */
|
---|
908 | export declare class I18nPluralPipe implements PipeTransform {
|
---|
909 | private _localization;
|
---|
910 | constructor(_localization: NgLocalization);
|
---|
911 | /**
|
---|
912 | * @param value the number to be formatted
|
---|
913 | * @param pluralMap an object that mimics the ICU format, see
|
---|
914 | * http://userguide.icu-project.org/formatparse/messages.
|
---|
915 | * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
|
---|
916 | * default).
|
---|
917 | */
|
---|
918 | transform(value: number | null | undefined, pluralMap: {
|
---|
919 | [count: string]: string;
|
---|
920 | }, locale?: string): string;
|
---|
921 | }
|
---|
922 |
|
---|
923 | /**
|
---|
924 | * @ngModule CommonModule
|
---|
925 | * @description
|
---|
926 | *
|
---|
927 | * Generic selector that displays the string that matches the current value.
|
---|
928 | *
|
---|
929 | * If none of the keys of the `mapping` match the `value`, then the content
|
---|
930 | * of the `other` key is returned when present, otherwise an empty string is returned.
|
---|
931 | *
|
---|
932 | * @usageNotes
|
---|
933 | *
|
---|
934 | * ### Example
|
---|
935 | *
|
---|
936 | * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
|
---|
937 | *
|
---|
938 | * @publicApi
|
---|
939 | */
|
---|
940 | export declare class I18nSelectPipe implements PipeTransform {
|
---|
941 | /**
|
---|
942 | * @param value a string to be internationalized.
|
---|
943 | * @param mapping an object that indicates the text that should be displayed
|
---|
944 | * for different values of the provided `value`.
|
---|
945 | */
|
---|
946 | transform(value: string | null | undefined, mapping: {
|
---|
947 | [key: string]: string;
|
---|
948 | }): string;
|
---|
949 | }
|
---|
950 |
|
---|
951 | /**
|
---|
952 | * Returns whether a platform id represents a browser platform.
|
---|
953 | * @publicApi
|
---|
954 | */
|
---|
955 | export declare function isPlatformBrowser(platformId: Object): boolean;
|
---|
956 |
|
---|
957 | /**
|
---|
958 | * Returns whether a platform id represents a server platform.
|
---|
959 | * @publicApi
|
---|
960 | */
|
---|
961 | export declare function isPlatformServer(platformId: Object): boolean;
|
---|
962 |
|
---|
963 | /**
|
---|
964 | * Returns whether a platform id represents a web worker app platform.
|
---|
965 | * @publicApi
|
---|
966 | */
|
---|
967 | export declare function isPlatformWorkerApp(platformId: Object): boolean;
|
---|
968 |
|
---|
969 | /**
|
---|
970 | * Returns whether a platform id represents a web worker UI platform.
|
---|
971 | * @publicApi
|
---|
972 | */
|
---|
973 | export declare function isPlatformWorkerUi(platformId: Object): boolean;
|
---|
974 |
|
---|
975 | /**
|
---|
976 | * @ngModule CommonModule
|
---|
977 | * @description
|
---|
978 | *
|
---|
979 | * Converts a value into its JSON-format representation. Useful for debugging.
|
---|
980 | *
|
---|
981 | * @usageNotes
|
---|
982 | *
|
---|
983 | * The following component uses a JSON pipe to convert an object
|
---|
984 | * to JSON format, and displays the string in both formats for comparison.
|
---|
985 | *
|
---|
986 | * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
|
---|
987 | *
|
---|
988 | * @publicApi
|
---|
989 | */
|
---|
990 | export declare class JsonPipe implements PipeTransform {
|
---|
991 | /**
|
---|
992 | * @param value A value of any type to convert into a JSON-format string.
|
---|
993 | */
|
---|
994 | transform(value: any): string;
|
---|
995 | }
|
---|
996 |
|
---|
997 | /**
|
---|
998 | * A key value pair.
|
---|
999 | * Usually used to represent the key value pairs from a Map or Object.
|
---|
1000 | *
|
---|
1001 | * @publicApi
|
---|
1002 | */
|
---|
1003 | export declare interface KeyValue<K, V> {
|
---|
1004 | key: K;
|
---|
1005 | value: V;
|
---|
1006 | }
|
---|
1007 |
|
---|
1008 | /**
|
---|
1009 | * @ngModule CommonModule
|
---|
1010 | * @description
|
---|
1011 | *
|
---|
1012 | * Transforms Object or Map into an array of key value pairs.
|
---|
1013 | *
|
---|
1014 | * The output array will be ordered by keys.
|
---|
1015 | * By default the comparator will be by Unicode point value.
|
---|
1016 | * You can optionally pass a compareFn if your keys are complex types.
|
---|
1017 | *
|
---|
1018 | * @usageNotes
|
---|
1019 | * ### Examples
|
---|
1020 | *
|
---|
1021 | * This examples show how an Object or a Map can be iterated by ngFor with the use of this
|
---|
1022 | * keyvalue pipe.
|
---|
1023 | *
|
---|
1024 | * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}
|
---|
1025 | *
|
---|
1026 | * @publicApi
|
---|
1027 | */
|
---|
1028 | export declare class KeyValuePipe implements PipeTransform {
|
---|
1029 | private readonly differs;
|
---|
1030 | constructor(differs: KeyValueDiffers);
|
---|
1031 | private differ;
|
---|
1032 | private keyValues;
|
---|
1033 | private compareFn;
|
---|
1034 | transform<K, V>(input: ReadonlyMap<K, V>, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>>;
|
---|
1035 | transform<K extends number, V>(input: Record<K, V>, compareFn?: (a: KeyValue<string, V>, b: KeyValue<string, V>) => number): Array<KeyValue<string, V>>;
|
---|
1036 | transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V>, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>>;
|
---|
1037 | transform(input: null | undefined, compareFn?: (a: KeyValue<unknown, unknown>, b: KeyValue<unknown, unknown>) => number): null;
|
---|
1038 | transform<K, V>(input: ReadonlyMap<K, V> | null | undefined, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>> | null;
|
---|
1039 | transform<K extends number, V>(input: Record<K, V> | null | undefined, compareFn?: (a: KeyValue<string, V>, b: KeyValue<string, V>) => number): Array<KeyValue<string, V>> | null;
|
---|
1040 | transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V> | null | undefined, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>> | null;
|
---|
1041 | }
|
---|
1042 |
|
---|
1043 | /**
|
---|
1044 | * @description
|
---|
1045 | *
|
---|
1046 | * A service that applications can use to interact with a browser's URL.
|
---|
1047 | *
|
---|
1048 | * Depending on the `LocationStrategy` used, `Location` persists
|
---|
1049 | * to the URL's path or the URL's hash segment.
|
---|
1050 | *
|
---|
1051 | * @usageNotes
|
---|
1052 | *
|
---|
1053 | * It's better to use the `Router.navigate()` service to trigger route changes. Use
|
---|
1054 | * `Location` only if you need to interact with or create normalized URLs outside of
|
---|
1055 | * routing.
|
---|
1056 | *
|
---|
1057 | * `Location` is responsible for normalizing the URL against the application's base href.
|
---|
1058 | * A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
---|
1059 | * trailing slash:
|
---|
1060 | * - `/my/app/user/123` is normalized
|
---|
1061 | * - `my/app/user/123` **is not** normalized
|
---|
1062 | * - `/my/app/user/123/` **is not** normalized
|
---|
1063 | *
|
---|
1064 | * ### Example
|
---|
1065 | *
|
---|
1066 | * <code-example path='common/location/ts/path_location_component.ts'
|
---|
1067 | * region='LocationComponent'></code-example>
|
---|
1068 | *
|
---|
1069 | * @publicApi
|
---|
1070 | */
|
---|
1071 | declare class Location_2 {
|
---|
1072 | constructor(platformStrategy: LocationStrategy, platformLocation: PlatformLocation);
|
---|
1073 | /**
|
---|
1074 | * Normalizes the URL path for this location.
|
---|
1075 | *
|
---|
1076 | * @param includeHash True to include an anchor fragment in the path.
|
---|
1077 | *
|
---|
1078 | * @returns The normalized URL path.
|
---|
1079 | */
|
---|
1080 | path(includeHash?: boolean): string;
|
---|
1081 | /**
|
---|
1082 | * Reports the current state of the location history.
|
---|
1083 | * @returns The current value of the `history.state` object.
|
---|
1084 | */
|
---|
1085 | getState(): unknown;
|
---|
1086 | /**
|
---|
1087 | * Normalizes the given path and compares to the current normalized path.
|
---|
1088 | *
|
---|
1089 | * @param path The given URL path.
|
---|
1090 | * @param query Query parameters.
|
---|
1091 | *
|
---|
1092 | * @returns True if the given URL path is equal to the current normalized path, false
|
---|
1093 | * otherwise.
|
---|
1094 | */
|
---|
1095 | isCurrentPathEqualTo(path: string, query?: string): boolean;
|
---|
1096 | /**
|
---|
1097 | * Normalizes a URL path by stripping any trailing slashes.
|
---|
1098 | *
|
---|
1099 | * @param url String representing a URL.
|
---|
1100 | *
|
---|
1101 | * @returns The normalized URL string.
|
---|
1102 | */
|
---|
1103 | normalize(url: string): string;
|
---|
1104 | /**
|
---|
1105 | * Normalizes an external URL path.
|
---|
1106 | * If the given URL doesn't begin with a leading slash (`'/'`), adds one
|
---|
1107 | * before normalizing. Adds a hash if `HashLocationStrategy` is
|
---|
1108 | * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
|
---|
1109 | *
|
---|
1110 | * @param url String representing a URL.
|
---|
1111 | *
|
---|
1112 | * @returns A normalized platform-specific URL.
|
---|
1113 | */
|
---|
1114 | prepareExternalUrl(url: string): string;
|
---|
1115 | /**
|
---|
1116 | * Changes the browser's URL to a normalized version of a given URL, and pushes a
|
---|
1117 | * new item onto the platform's history.
|
---|
1118 | *
|
---|
1119 | * @param path URL path to normalize.
|
---|
1120 | * @param query Query parameters.
|
---|
1121 | * @param state Location history state.
|
---|
1122 | *
|
---|
1123 | */
|
---|
1124 | go(path: string, query?: string, state?: any): void;
|
---|
1125 | /**
|
---|
1126 | * Changes the browser's URL to a normalized version of the given URL, and replaces
|
---|
1127 | * the top item on the platform's history stack.
|
---|
1128 | *
|
---|
1129 | * @param path URL path to normalize.
|
---|
1130 | * @param query Query parameters.
|
---|
1131 | * @param state Location history state.
|
---|
1132 | */
|
---|
1133 | replaceState(path: string, query?: string, state?: any): void;
|
---|
1134 | /**
|
---|
1135 | * Navigates forward in the platform's history.
|
---|
1136 | */
|
---|
1137 | forward(): void;
|
---|
1138 | /**
|
---|
1139 | * Navigates back in the platform's history.
|
---|
1140 | */
|
---|
1141 | back(): void;
|
---|
1142 | /**
|
---|
1143 | * Navigate to a specific page from session history, identified by its relative position to the
|
---|
1144 | * current page.
|
---|
1145 | *
|
---|
1146 | * @param relativePosition Position of the target page in the history relative to the current
|
---|
1147 | * page.
|
---|
1148 | * A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`
|
---|
1149 | * moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go
|
---|
1150 | * beyond what's stored in the history session, we stay in the current page. Same behaviour occurs
|
---|
1151 | * when `relativePosition` equals 0.
|
---|
1152 | * @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history
|
---|
1153 | */
|
---|
1154 | historyGo(relativePosition?: number): void;
|
---|
1155 | /**
|
---|
1156 | * Registers a URL change listener. Use to catch updates performed by the Angular
|
---|
1157 | * framework that are not detectible through "popstate" or "hashchange" events.
|
---|
1158 | *
|
---|
1159 | * @param fn The change handler function, which take a URL and a location history state.
|
---|
1160 | */
|
---|
1161 | onUrlChange(fn: (url: string, state: unknown) => void): void;
|
---|
1162 | /**
|
---|
1163 | * Subscribes to the platform's `popState` events.
|
---|
1164 | *
|
---|
1165 | * Note: `Location.go()` does not trigger the `popState` event in the browser. Use
|
---|
1166 | * `Location.onUrlChange()` to subscribe to URL changes instead.
|
---|
1167 | *
|
---|
1168 | * @param value Event that is triggered when the state history changes.
|
---|
1169 | * @param exception The exception to throw.
|
---|
1170 | *
|
---|
1171 | * @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)
|
---|
1172 | *
|
---|
1173 | * @returns Subscribed events.
|
---|
1174 | */
|
---|
1175 | subscribe(onNext: (value: PopStateEvent_2) => void, onThrow?: ((exception: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
|
---|
1176 | /**
|
---|
1177 | * Normalizes URL parameters by prepending with `?` if needed.
|
---|
1178 | *
|
---|
1179 | * @param params String of URL parameters.
|
---|
1180 | *
|
---|
1181 | * @returns The normalized URL parameters string.
|
---|
1182 | */
|
---|
1183 | static normalizeQueryParams: (params: string) => string;
|
---|
1184 | /**
|
---|
1185 | * Joins two parts of a URL with a slash if needed.
|
---|
1186 | *
|
---|
1187 | * @param start URL string
|
---|
1188 | * @param end URL string
|
---|
1189 | *
|
---|
1190 | *
|
---|
1191 | * @returns The joined URL string.
|
---|
1192 | */
|
---|
1193 | static joinWithSlash: (start: string, end: string) => string;
|
---|
1194 | /**
|
---|
1195 | * Removes a trailing slash from a URL string if needed.
|
---|
1196 | * Looks for the first occurrence of either `#`, `?`, or the end of the
|
---|
1197 | * line as `/` characters and removes the trailing slash if one exists.
|
---|
1198 | *
|
---|
1199 | * @param url URL string.
|
---|
1200 | *
|
---|
1201 | * @returns The URL string, modified if needed.
|
---|
1202 | */
|
---|
1203 | static stripTrailingSlash: (url: string) => string;
|
---|
1204 | }
|
---|
1205 | export { Location_2 as Location }
|
---|
1206 |
|
---|
1207 | /**
|
---|
1208 | * @description
|
---|
1209 | * Indicates when a location is initialized.
|
---|
1210 | *
|
---|
1211 | * @publicApi
|
---|
1212 | */
|
---|
1213 | export declare const LOCATION_INITIALIZED: InjectionToken<Promise<any>>;
|
---|
1214 |
|
---|
1215 | /**
|
---|
1216 | * @description
|
---|
1217 | * A serializable version of the event from `onPopState` or `onHashChange`
|
---|
1218 | *
|
---|
1219 | * @publicApi
|
---|
1220 | */
|
---|
1221 | export declare interface LocationChangeEvent {
|
---|
1222 | type: string;
|
---|
1223 | state: any;
|
---|
1224 | }
|
---|
1225 |
|
---|
1226 | /**
|
---|
1227 | * @publicApi
|
---|
1228 | */
|
---|
1229 | export declare interface LocationChangeListener {
|
---|
1230 | (event: LocationChangeEvent): any;
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | /**
|
---|
1234 | * Enables the `Location` service to read route state from the browser's URL.
|
---|
1235 | * Angular provides two strategies:
|
---|
1236 | * `HashLocationStrategy` and `PathLocationStrategy`.
|
---|
1237 | *
|
---|
1238 | * Applications should use the `Router` or `Location` services to
|
---|
1239 | * interact with application route state.
|
---|
1240 | *
|
---|
1241 | * For instance, `HashLocationStrategy` produces URLs like
|
---|
1242 | * <code class="no-auto-link">http://example.com#/foo</code>,
|
---|
1243 | * and `PathLocationStrategy` produces
|
---|
1244 | * <code class="no-auto-link">http://example.com/foo</code> as an equivalent URL.
|
---|
1245 | *
|
---|
1246 | * See these two classes for more.
|
---|
1247 | *
|
---|
1248 | * @publicApi
|
---|
1249 | */
|
---|
1250 | export declare abstract class LocationStrategy {
|
---|
1251 | abstract path(includeHash?: boolean): string;
|
---|
1252 | abstract prepareExternalUrl(internal: string): string;
|
---|
1253 | abstract pushState(state: any, title: string, url: string, queryParams: string): void;
|
---|
1254 | abstract replaceState(state: any, title: string, url: string, queryParams: string): void;
|
---|
1255 | abstract forward(): void;
|
---|
1256 | abstract back(): void;
|
---|
1257 | historyGo?(relativePosition: number): void;
|
---|
1258 | abstract onPopState(fn: LocationChangeListener): void;
|
---|
1259 | abstract getBaseHref(): string;
|
---|
1260 | }
|
---|
1261 |
|
---|
1262 | /**
|
---|
1263 | * Transforms text to all lower case.
|
---|
1264 | *
|
---|
1265 | * @see `UpperCasePipe`
|
---|
1266 | * @see `TitleCasePipe`
|
---|
1267 | * @usageNotes
|
---|
1268 | *
|
---|
1269 | * The following example defines a view that allows the user to enter
|
---|
1270 | * text, and then uses the pipe to convert the input text to all lower case.
|
---|
1271 | *
|
---|
1272 | * <code-example path="common/pipes/ts/lowerupper_pipe.ts" region='LowerUpperPipe'></code-example>
|
---|
1273 | *
|
---|
1274 | * @ngModule CommonModule
|
---|
1275 | * @publicApi
|
---|
1276 | */
|
---|
1277 | export declare class LowerCasePipe implements PipeTransform {
|
---|
1278 | /**
|
---|
1279 | * @param value The string to transform to lower case.
|
---|
1280 | */
|
---|
1281 | transform(value: string): string;
|
---|
1282 | transform(value: null | undefined): null;
|
---|
1283 | transform(value: string | null | undefined): string | null;
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | /**
|
---|
1287 | * @ngModule CommonModule
|
---|
1288 | *
|
---|
1289 | * @usageNotes
|
---|
1290 | * ```
|
---|
1291 | * <some-element [ngClass]="'first second'">...</some-element>
|
---|
1292 | *
|
---|
1293 | * <some-element [ngClass]="['first', 'second']">...</some-element>
|
---|
1294 | *
|
---|
1295 | * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
|
---|
1296 | *
|
---|
1297 | * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
|
---|
1298 | *
|
---|
1299 | * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
|
---|
1300 | * ```
|
---|
1301 | *
|
---|
1302 | * @description
|
---|
1303 | *
|
---|
1304 | * Adds and removes CSS classes on an HTML element.
|
---|
1305 | *
|
---|
1306 | * The CSS classes are updated as follows, depending on the type of the expression evaluation:
|
---|
1307 | * - `string` - the CSS classes listed in the string (space delimited) are added,
|
---|
1308 | * - `Array` - the CSS classes declared as Array elements are added,
|
---|
1309 | * - `Object` - keys are CSS classes that get added when the expression given in the value
|
---|
1310 | * evaluates to a truthy value, otherwise they are removed.
|
---|
1311 | *
|
---|
1312 | * @publicApi
|
---|
1313 | */
|
---|
1314 | export declare class NgClass implements DoCheck {
|
---|
1315 | private _iterableDiffers;
|
---|
1316 | private _keyValueDiffers;
|
---|
1317 | private _ngEl;
|
---|
1318 | private _renderer;
|
---|
1319 | private _iterableDiffer;
|
---|
1320 | private _keyValueDiffer;
|
---|
1321 | private _initialClasses;
|
---|
1322 | private _rawClass;
|
---|
1323 | constructor(_iterableDiffers: IterableDiffers, _keyValueDiffers: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer2);
|
---|
1324 | set klass(value: string);
|
---|
1325 | set ngClass(value: string | string[] | Set<string> | {
|
---|
1326 | [klass: string]: any;
|
---|
1327 | });
|
---|
1328 | ngDoCheck(): void;
|
---|
1329 | private _applyKeyValueChanges;
|
---|
1330 | private _applyIterableChanges;
|
---|
1331 | /**
|
---|
1332 | * Applies a collection of CSS classes to the DOM element.
|
---|
1333 | *
|
---|
1334 | * For argument of type Set and Array CSS class names contained in those collections are always
|
---|
1335 | * added.
|
---|
1336 | * For argument of type Map CSS class name in the map's key is toggled based on the value (added
|
---|
1337 | * for truthy and removed for falsy).
|
---|
1338 | */
|
---|
1339 | private _applyClasses;
|
---|
1340 | /**
|
---|
1341 | * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup
|
---|
1342 | * purposes.
|
---|
1343 | */
|
---|
1344 | private _removeClasses;
|
---|
1345 | private _toggleClass;
|
---|
1346 | }
|
---|
1347 |
|
---|
1348 | /**
|
---|
1349 | * Instantiates a {@link Component} type and inserts its Host View into the current View.
|
---|
1350 | * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
|
---|
1351 | *
|
---|
1352 | * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
|
---|
1353 | * any existing component will be destroyed.
|
---|
1354 | *
|
---|
1355 | * @usageNotes
|
---|
1356 | *
|
---|
1357 | * ### Fine tune control
|
---|
1358 | *
|
---|
1359 | * You can control the component creation process by using the following optional attributes:
|
---|
1360 | *
|
---|
1361 | * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for
|
---|
1362 | * the Component. Defaults to the injector of the current view container.
|
---|
1363 | *
|
---|
1364 | * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
|
---|
1365 | * section of the component, if it exists.
|
---|
1366 | *
|
---|
1367 | * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow loading another
|
---|
1368 | * module dynamically, then loading a component from that module.
|
---|
1369 | *
|
---|
1370 | * ### Syntax
|
---|
1371 | *
|
---|
1372 | * Simple
|
---|
1373 | * ```
|
---|
1374 | * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
|
---|
1375 | * ```
|
---|
1376 | *
|
---|
1377 | * Customized injector/content
|
---|
1378 | * ```
|
---|
1379 | * <ng-container *ngComponentOutlet="componentTypeExpression;
|
---|
1380 | * injector: injectorExpression;
|
---|
1381 | * content: contentNodesExpression;">
|
---|
1382 | * </ng-container>
|
---|
1383 | * ```
|
---|
1384 | *
|
---|
1385 | * Customized ngModuleFactory
|
---|
1386 | * ```
|
---|
1387 | * <ng-container *ngComponentOutlet="componentTypeExpression;
|
---|
1388 | * ngModuleFactory: moduleFactory;">
|
---|
1389 | * </ng-container>
|
---|
1390 | * ```
|
---|
1391 | *
|
---|
1392 | * ### A simple example
|
---|
1393 | *
|
---|
1394 | * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
|
---|
1395 | *
|
---|
1396 | * A more complete example with additional options:
|
---|
1397 | *
|
---|
1398 | * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
|
---|
1399 | *
|
---|
1400 | * @publicApi
|
---|
1401 | * @ngModule CommonModule
|
---|
1402 | */
|
---|
1403 | export declare class NgComponentOutlet implements OnChanges, OnDestroy {
|
---|
1404 | private _viewContainerRef;
|
---|
1405 | ngComponentOutlet: Type<any>;
|
---|
1406 | ngComponentOutletInjector: Injector;
|
---|
1407 | ngComponentOutletContent: any[][];
|
---|
1408 | ngComponentOutletNgModuleFactory: NgModuleFactory<any>;
|
---|
1409 | private _componentRef;
|
---|
1410 | private _moduleRef;
|
---|
1411 | constructor(_viewContainerRef: ViewContainerRef);
|
---|
1412 | ngOnChanges(changes: SimpleChanges): void;
|
---|
1413 | ngOnDestroy(): void;
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | /**
|
---|
1417 | * A [structural directive](guide/structural-directives) that renders
|
---|
1418 | * a template for each item in a collection.
|
---|
1419 | * The directive is placed on an element, which becomes the parent
|
---|
1420 | * of the cloned templates.
|
---|
1421 | *
|
---|
1422 | * The `ngForOf` directive is generally used in the
|
---|
1423 | * [shorthand form](guide/structural-directives#asterisk) `*ngFor`.
|
---|
1424 | * In this form, the template to be rendered for each iteration is the content
|
---|
1425 | * of an anchor element containing the directive.
|
---|
1426 | *
|
---|
1427 | * The following example shows the shorthand syntax with some options,
|
---|
1428 | * contained in an `<li>` element.
|
---|
1429 | *
|
---|
1430 | * ```
|
---|
1431 | * <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>
|
---|
1432 | * ```
|
---|
1433 | *
|
---|
1434 | * The shorthand form expands into a long form that uses the `ngForOf` selector
|
---|
1435 | * on an `<ng-template>` element.
|
---|
1436 | * The content of the `<ng-template>` element is the `<li>` element that held the
|
---|
1437 | * short-form directive.
|
---|
1438 | *
|
---|
1439 | * Here is the expanded version of the short-form example.
|
---|
1440 | *
|
---|
1441 | * ```
|
---|
1442 | * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
|
---|
1443 | * <li>...</li>
|
---|
1444 | * </ng-template>
|
---|
1445 | * ```
|
---|
1446 | *
|
---|
1447 | * Angular automatically expands the shorthand syntax as it compiles the template.
|
---|
1448 | * The context for each embedded view is logically merged to the current component
|
---|
1449 | * context according to its lexical position.
|
---|
1450 | *
|
---|
1451 | * When using the shorthand syntax, Angular allows only [one structural directive
|
---|
1452 | * on an element](guide/built-in-directives#one-per-element).
|
---|
1453 | * If you want to iterate conditionally, for example,
|
---|
1454 | * put the `*ngIf` on a container element that wraps the `*ngFor` element.
|
---|
1455 | * For futher discussion, see
|
---|
1456 | * [Structural Directives](guide/built-in-directives#one-per-element).
|
---|
1457 | *
|
---|
1458 | * @usageNotes
|
---|
1459 | *
|
---|
1460 | * ### Local variables
|
---|
1461 | *
|
---|
1462 | * `NgForOf` provides exported values that can be aliased to local variables.
|
---|
1463 | * For example:
|
---|
1464 | *
|
---|
1465 | * ```
|
---|
1466 | * <li *ngFor="let user of users; index as i; first as isFirst">
|
---|
1467 | * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
|
---|
1468 | * </li>
|
---|
1469 | * ```
|
---|
1470 | *
|
---|
1471 | * The following exported values can be aliased to local variables:
|
---|
1472 | *
|
---|
1473 | * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
|
---|
1474 | * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
|
---|
1475 | * more complex then a property access, for example when using the async pipe (`userStreams |
|
---|
1476 | * async`).
|
---|
1477 | * - `index: number`: The index of the current item in the iterable.
|
---|
1478 | * - `count: number`: The length of the iterable.
|
---|
1479 | * - `first: boolean`: True when the item is the first item in the iterable.
|
---|
1480 | * - `last: boolean`: True when the item is the last item in the iterable.
|
---|
1481 | * - `even: boolean`: True when the item has an even index in the iterable.
|
---|
1482 | * - `odd: boolean`: True when the item has an odd index in the iterable.
|
---|
1483 | *
|
---|
1484 | * ### Change propagation
|
---|
1485 | *
|
---|
1486 | * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
|
---|
1487 | *
|
---|
1488 | * * When an item is added, a new instance of the template is added to the DOM.
|
---|
1489 | * * When an item is removed, its template instance is removed from the DOM.
|
---|
1490 | * * When items are reordered, their respective templates are reordered in the DOM.
|
---|
1491 | *
|
---|
1492 | * Angular uses object identity to track insertions and deletions within the iterator and reproduce
|
---|
1493 | * those changes in the DOM. This has important implications for animations and any stateful
|
---|
1494 | * controls that are present, such as `<input>` elements that accept user input. Inserted rows can
|
---|
1495 | * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
|
---|
1496 | * such as user input.
|
---|
1497 | * For more on animations, see [Transitions and Triggers](guide/transition-and-triggers).
|
---|
1498 | *
|
---|
1499 | * The identities of elements in the iterator can change while the data does not.
|
---|
1500 | * This can happen, for example, if the iterator is produced from an RPC to the server, and that
|
---|
1501 | * RPC is re-run. Even if the data hasn't changed, the second response produces objects with
|
---|
1502 | * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old
|
---|
1503 | * elements were deleted and all new elements inserted).
|
---|
1504 | *
|
---|
1505 | * To avoid this expensive operation, you can customize the default tracking algorithm.
|
---|
1506 | * by supplying the `trackBy` option to `NgForOf`.
|
---|
1507 | * `trackBy` takes a function that has two arguments: `index` and `item`.
|
---|
1508 | * If `trackBy` is given, Angular tracks changes by the return value of the function.
|
---|
1509 | *
|
---|
1510 | * @see [Structural Directives](guide/structural-directives)
|
---|
1511 | * @ngModule CommonModule
|
---|
1512 | * @publicApi
|
---|
1513 | */
|
---|
1514 | export declare class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCheck {
|
---|
1515 | private _viewContainer;
|
---|
1516 | private _template;
|
---|
1517 | private _differs;
|
---|
1518 | /**
|
---|
1519 | * The value of the iterable expression, which can be used as a
|
---|
1520 | * [template input variable](guide/structural-directives#shorthand).
|
---|
1521 | */
|
---|
1522 | set ngForOf(ngForOf: U & NgIterable<T> | undefined | null);
|
---|
1523 | /**
|
---|
1524 | * Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.
|
---|
1525 | *
|
---|
1526 | * If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object
|
---|
1527 | * identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
|
---|
1528 | * as the key.
|
---|
1529 | *
|
---|
1530 | * `NgForOf` uses the computed key to associate items in an iterable with DOM elements
|
---|
1531 | * it produces for these items.
|
---|
1532 | *
|
---|
1533 | * A custom `TrackByFunction` is useful to provide good user experience in cases when items in an
|
---|
1534 | * iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a
|
---|
1535 | * primary key), and this iterable could be updated with new object instances that still
|
---|
1536 | * represent the same underlying entity (for example, when data is re-fetched from the server,
|
---|
1537 | * and the iterable is recreated and re-rendered, but most of the data is still the same).
|
---|
1538 | *
|
---|
1539 | * @see `TrackByFunction`
|
---|
1540 | */
|
---|
1541 | set ngForTrackBy(fn: TrackByFunction<T>);
|
---|
1542 | get ngForTrackBy(): TrackByFunction<T>;
|
---|
1543 | private _ngForOf;
|
---|
1544 | private _ngForOfDirty;
|
---|
1545 | private _differ;
|
---|
1546 | private _trackByFn;
|
---|
1547 | constructor(_viewContainer: ViewContainerRef, _template: TemplateRef<NgForOfContext<T, U>>, _differs: IterableDiffers);
|
---|
1548 | /**
|
---|
1549 | * A reference to the template that is stamped out for each item in the iterable.
|
---|
1550 | * @see [template reference variable](guide/template-reference-variables)
|
---|
1551 | */
|
---|
1552 | set ngForTemplate(value: TemplateRef<NgForOfContext<T, U>>);
|
---|
1553 | /**
|
---|
1554 | * Applies the changes when needed.
|
---|
1555 | */
|
---|
1556 | ngDoCheck(): void;
|
---|
1557 | private _applyChanges;
|
---|
1558 | private _perViewChange;
|
---|
1559 | /**
|
---|
1560 | * Asserts the correct type of the context for the template that `NgForOf` will render.
|
---|
1561 | *
|
---|
1562 | * The presence of this method is a signal to the Ivy template type-check compiler that the
|
---|
1563 | * `NgForOf` structural directive renders its template with a specific context type.
|
---|
1564 | */
|
---|
1565 | static ngTemplateContextGuard<T, U extends NgIterable<T>>(dir: NgForOf<T, U>, ctx: any): ctx is NgForOfContext<T, U>;
|
---|
1566 | }
|
---|
1567 |
|
---|
1568 | /**
|
---|
1569 | * @publicApi
|
---|
1570 | */
|
---|
1571 | export declare class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {
|
---|
1572 | $implicit: T;
|
---|
1573 | ngForOf: U;
|
---|
1574 | index: number;
|
---|
1575 | count: number;
|
---|
1576 | constructor($implicit: T, ngForOf: U, index: number, count: number);
|
---|
1577 | get first(): boolean;
|
---|
1578 | get last(): boolean;
|
---|
1579 | get even(): boolean;
|
---|
1580 | get odd(): boolean;
|
---|
1581 | }
|
---|
1582 |
|
---|
1583 | /**
|
---|
1584 | * A structural directive that conditionally includes a template based on the value of
|
---|
1585 | * an expression coerced to Boolean.
|
---|
1586 | * When the expression evaluates to true, Angular renders the template
|
---|
1587 | * provided in a `then` clause, and when false or null,
|
---|
1588 | * Angular renders the template provided in an optional `else` clause. The default
|
---|
1589 | * template for the `else` clause is blank.
|
---|
1590 | *
|
---|
1591 | * A [shorthand form](guide/structural-directives#asterisk) of the directive,
|
---|
1592 | * `*ngIf="condition"`, is generally used, provided
|
---|
1593 | * as an attribute of the anchor element for the inserted template.
|
---|
1594 | * Angular expands this into a more explicit version, in which the anchor element
|
---|
1595 | * is contained in an `<ng-template>` element.
|
---|
1596 | *
|
---|
1597 | * Simple form with shorthand syntax:
|
---|
1598 | *
|
---|
1599 | * ```
|
---|
1600 | * <div *ngIf="condition">Content to render when condition is true.</div>
|
---|
1601 | * ```
|
---|
1602 | *
|
---|
1603 | * Simple form with expanded syntax:
|
---|
1604 | *
|
---|
1605 | * ```
|
---|
1606 | * <ng-template [ngIf]="condition"><div>Content to render when condition is
|
---|
1607 | * true.</div></ng-template>
|
---|
1608 | * ```
|
---|
1609 | *
|
---|
1610 | * Form with an "else" block:
|
---|
1611 | *
|
---|
1612 | * ```
|
---|
1613 | * <div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
|
---|
1614 | * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
|
---|
1615 | * ```
|
---|
1616 | *
|
---|
1617 | * Shorthand form with "then" and "else" blocks:
|
---|
1618 | *
|
---|
1619 | * ```
|
---|
1620 | * <div *ngIf="condition; then thenBlock else elseBlock"></div>
|
---|
1621 | * <ng-template #thenBlock>Content to render when condition is true.</ng-template>
|
---|
1622 | * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
|
---|
1623 | * ```
|
---|
1624 | *
|
---|
1625 | * Form with storing the value locally:
|
---|
1626 | *
|
---|
1627 | * ```
|
---|
1628 | * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
|
---|
1629 | * <ng-template #elseBlock>Content to render when value is null.</ng-template>
|
---|
1630 | * ```
|
---|
1631 | *
|
---|
1632 | * @usageNotes
|
---|
1633 | *
|
---|
1634 | * The `*ngIf` directive is most commonly used to conditionally show an inline template,
|
---|
1635 | * as seen in the following example.
|
---|
1636 | * The default `else` template is blank.
|
---|
1637 | *
|
---|
1638 | * {@example common/ngIf/ts/module.ts region='NgIfSimple'}
|
---|
1639 | *
|
---|
1640 | * ### Showing an alternative template using `else`
|
---|
1641 | *
|
---|
1642 | * To display a template when `expression` evaluates to false, use an `else` template
|
---|
1643 | * binding as shown in the following example.
|
---|
1644 | * The `else` binding points to an `<ng-template>` element labeled `#elseBlock`.
|
---|
1645 | * The template can be defined anywhere in the component view, but is typically placed right after
|
---|
1646 | * `ngIf` for readability.
|
---|
1647 | *
|
---|
1648 | * {@example common/ngIf/ts/module.ts region='NgIfElse'}
|
---|
1649 | *
|
---|
1650 | * ### Using an external `then` template
|
---|
1651 | *
|
---|
1652 | * In the previous example, the then-clause template is specified inline, as the content of the
|
---|
1653 | * tag that contains the `ngIf` directive. You can also specify a template that is defined
|
---|
1654 | * externally, by referencing a labeled `<ng-template>` element. When you do this, you can
|
---|
1655 | * change which template to use at runtime, as shown in the following example.
|
---|
1656 | *
|
---|
1657 | * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
|
---|
1658 | *
|
---|
1659 | * ### Storing a conditional result in a variable
|
---|
1660 | *
|
---|
1661 | * You might want to show a set of properties from the same object. If you are waiting
|
---|
1662 | * for asynchronous data, the object can be undefined.
|
---|
1663 | * In this case, you can use `ngIf` and store the result of the condition in a local
|
---|
1664 | * variable as shown in the following example.
|
---|
1665 | *
|
---|
1666 | * {@example common/ngIf/ts/module.ts region='NgIfAs'}
|
---|
1667 | *
|
---|
1668 | * This code uses only one `AsyncPipe`, so only one subscription is created.
|
---|
1669 | * The conditional statement stores the result of `userStream|async` in the local variable `user`.
|
---|
1670 | * You can then bind the local `user` repeatedly.
|
---|
1671 | *
|
---|
1672 | * The conditional displays the data only if `userStream` returns a value,
|
---|
1673 | * so you don't need to use the
|
---|
1674 | * safe-navigation-operator (`?.`)
|
---|
1675 | * to guard against null values when accessing properties.
|
---|
1676 | * You can display an alternative template while waiting for the data.
|
---|
1677 | *
|
---|
1678 | * ### Shorthand syntax
|
---|
1679 | *
|
---|
1680 | * The shorthand syntax `*ngIf` expands into two separate template specifications
|
---|
1681 | * for the "then" and "else" clauses. For example, consider the following shorthand statement,
|
---|
1682 | * that is meant to show a loading page while waiting for data to be loaded.
|
---|
1683 | *
|
---|
1684 | * ```
|
---|
1685 | * <div class="hero-list" *ngIf="heroes else loading">
|
---|
1686 | * ...
|
---|
1687 | * </div>
|
---|
1688 | *
|
---|
1689 | * <ng-template #loading>
|
---|
1690 | * <div>Loading...</div>
|
---|
1691 | * </ng-template>
|
---|
1692 | * ```
|
---|
1693 | *
|
---|
1694 | * You can see that the "else" clause references the `<ng-template>`
|
---|
1695 | * with the `#loading` label, and the template for the "then" clause
|
---|
1696 | * is provided as the content of the anchor element.
|
---|
1697 | *
|
---|
1698 | * However, when Angular expands the shorthand syntax, it creates
|
---|
1699 | * another `<ng-template>` tag, with `ngIf` and `ngIfElse` directives.
|
---|
1700 | * The anchor element containing the template for the "then" clause becomes
|
---|
1701 | * the content of this unlabeled `<ng-template>` tag.
|
---|
1702 | *
|
---|
1703 | * ```
|
---|
1704 | * <ng-template [ngIf]="heroes" [ngIfElse]="loading">
|
---|
1705 | * <div class="hero-list">
|
---|
1706 | * ...
|
---|
1707 | * </div>
|
---|
1708 | * </ng-template>
|
---|
1709 | *
|
---|
1710 | * <ng-template #loading>
|
---|
1711 | * <div>Loading...</div>
|
---|
1712 | * </ng-template>
|
---|
1713 | * ```
|
---|
1714 | *
|
---|
1715 | * The presence of the implicit template object has implications for the nesting of
|
---|
1716 | * structural directives. For more on this subject, see
|
---|
1717 | * [Structural Directives](https://angular.io/guide/built-in-directives#one-per-element).
|
---|
1718 | *
|
---|
1719 | * @ngModule CommonModule
|
---|
1720 | * @publicApi
|
---|
1721 | */
|
---|
1722 | export declare class NgIf<T = unknown> {
|
---|
1723 | private _viewContainer;
|
---|
1724 | private _context;
|
---|
1725 | private _thenTemplateRef;
|
---|
1726 | private _elseTemplateRef;
|
---|
1727 | private _thenViewRef;
|
---|
1728 | private _elseViewRef;
|
---|
1729 | constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext<T>>);
|
---|
1730 | /**
|
---|
1731 | * The Boolean expression to evaluate as the condition for showing a template.
|
---|
1732 | */
|
---|
1733 | set ngIf(condition: T);
|
---|
1734 | /**
|
---|
1735 | * A template to show if the condition expression evaluates to true.
|
---|
1736 | */
|
---|
1737 | set ngIfThen(templateRef: TemplateRef<NgIfContext<T>> | null);
|
---|
1738 | /**
|
---|
1739 | * A template to show if the condition expression evaluates to false.
|
---|
1740 | */
|
---|
1741 | set ngIfElse(templateRef: TemplateRef<NgIfContext<T>> | null);
|
---|
1742 | private _updateView;
|
---|
1743 | /**
|
---|
1744 | * Assert the correct type of the expression bound to the `ngIf` input within the template.
|
---|
1745 | *
|
---|
1746 | * The presence of this static field is a signal to the Ivy template type check compiler that
|
---|
1747 | * when the `NgIf` structural directive renders its template, the type of the expression bound
|
---|
1748 | * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
|
---|
1749 | * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
|
---|
1750 | */
|
---|
1751 | static ngTemplateGuard_ngIf: 'binding';
|
---|
1752 | /**
|
---|
1753 | * Asserts the correct type of the context for the template that `NgIf` will render.
|
---|
1754 | *
|
---|
1755 | * The presence of this method is a signal to the Ivy template type-check compiler that the
|
---|
1756 | * `NgIf` structural directive renders its template with a specific context type.
|
---|
1757 | */
|
---|
1758 | static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): ctx is NgIfContext<Exclude<T, false | 0 | '' | null | undefined>>;
|
---|
1759 | }
|
---|
1760 |
|
---|
1761 | /**
|
---|
1762 | * @publicApi
|
---|
1763 | */
|
---|
1764 | export declare class NgIfContext<T = unknown> {
|
---|
1765 | $implicit: T;
|
---|
1766 | ngIf: T;
|
---|
1767 | }
|
---|
1768 |
|
---|
1769 | /**
|
---|
1770 | * Returns the plural case based on the locale
|
---|
1771 | *
|
---|
1772 | * @publicApi
|
---|
1773 | */
|
---|
1774 | export declare class NgLocaleLocalization extends NgLocalization {
|
---|
1775 | protected locale: string;
|
---|
1776 | constructor(locale: string);
|
---|
1777 | getPluralCategory(value: any, locale?: string): string;
|
---|
1778 | }
|
---|
1779 |
|
---|
1780 |
|
---|
1781 | /**
|
---|
1782 | * @publicApi
|
---|
1783 | */
|
---|
1784 | export declare abstract class NgLocalization {
|
---|
1785 | abstract getPluralCategory(value: any, locale?: string): string;
|
---|
1786 | }
|
---|
1787 |
|
---|
1788 | /**
|
---|
1789 | * @ngModule CommonModule
|
---|
1790 | *
|
---|
1791 | * @usageNotes
|
---|
1792 | * ```
|
---|
1793 | * <some-element [ngPlural]="value">
|
---|
1794 | * <ng-template ngPluralCase="=0">there is nothing</ng-template>
|
---|
1795 | * <ng-template ngPluralCase="=1">there is one</ng-template>
|
---|
1796 | * <ng-template ngPluralCase="few">there are a few</ng-template>
|
---|
1797 | * </some-element>
|
---|
1798 | * ```
|
---|
1799 | *
|
---|
1800 | * @description
|
---|
1801 | *
|
---|
1802 | * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
|
---|
1803 | *
|
---|
1804 | * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
|
---|
1805 | * that match the switch expression's pluralization category.
|
---|
1806 | *
|
---|
1807 | * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
|
---|
1808 | * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
|
---|
1809 | * expression:
|
---|
1810 | * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
|
---|
1811 | * matches the switch expression exactly,
|
---|
1812 | * - otherwise, the view will be treated as a "category match", and will only display if exact
|
---|
1813 | * value matches aren't found and the value maps to its category for the defined locale.
|
---|
1814 | *
|
---|
1815 | * See http://cldr.unicode.org/index/cldr-spec/plural-rules
|
---|
1816 | *
|
---|
1817 | * @publicApi
|
---|
1818 | */
|
---|
1819 | export declare class NgPlural {
|
---|
1820 | private _localization;
|
---|
1821 | private _switchValue;
|
---|
1822 | private _activeView;
|
---|
1823 | private _caseViews;
|
---|
1824 | constructor(_localization: NgLocalization);
|
---|
1825 | set ngPlural(value: number);
|
---|
1826 | addCase(value: string, switchView: SwitchView): void;
|
---|
1827 | private _updateView;
|
---|
1828 | private _clearViews;
|
---|
1829 | private _activateView;
|
---|
1830 | }
|
---|
1831 |
|
---|
1832 | /**
|
---|
1833 | * @ngModule CommonModule
|
---|
1834 | *
|
---|
1835 | * @description
|
---|
1836 | *
|
---|
1837 | * Creates a view that will be added/removed from the parent {@link NgPlural} when the
|
---|
1838 | * given expression matches the plural expression according to CLDR rules.
|
---|
1839 | *
|
---|
1840 | * @usageNotes
|
---|
1841 | * ```
|
---|
1842 | * <some-element [ngPlural]="value">
|
---|
1843 | * <ng-template ngPluralCase="=0">...</ng-template>
|
---|
1844 | * <ng-template ngPluralCase="other">...</ng-template>
|
---|
1845 | * </some-element>
|
---|
1846 | *```
|
---|
1847 | *
|
---|
1848 | * See {@link NgPlural} for more details and example.
|
---|
1849 | *
|
---|
1850 | * @publicApi
|
---|
1851 | */
|
---|
1852 | export declare class NgPluralCase {
|
---|
1853 | value: string;
|
---|
1854 | constructor(value: string, template: TemplateRef<Object>, viewContainer: ViewContainerRef, ngPlural: NgPlural);
|
---|
1855 | }
|
---|
1856 |
|
---|
1857 | /**
|
---|
1858 | * @ngModule CommonModule
|
---|
1859 | *
|
---|
1860 | * @usageNotes
|
---|
1861 | *
|
---|
1862 | * Set the font of the containing element to the result of an expression.
|
---|
1863 | *
|
---|
1864 | * ```
|
---|
1865 | * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
|
---|
1866 | * ```
|
---|
1867 | *
|
---|
1868 | * Set the width of the containing element to a pixel value returned by an expression.
|
---|
1869 | *
|
---|
1870 | * ```
|
---|
1871 | * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
|
---|
1872 | * ```
|
---|
1873 | *
|
---|
1874 | * Set a collection of style values using an expression that returns key-value pairs.
|
---|
1875 | *
|
---|
1876 | * ```
|
---|
1877 | * <some-element [ngStyle]="objExp">...</some-element>
|
---|
1878 | * ```
|
---|
1879 | *
|
---|
1880 | * @description
|
---|
1881 | *
|
---|
1882 | * An attribute directive that updates styles for the containing HTML element.
|
---|
1883 | * Sets one or more style properties, specified as colon-separated key-value pairs.
|
---|
1884 | * The key is a style name, with an optional `.<unit>` suffix
|
---|
1885 | * (such as 'top.px', 'font-style.em').
|
---|
1886 | * The value is an expression to be evaluated.
|
---|
1887 | * The resulting non-null value, expressed in the given unit,
|
---|
1888 | * is assigned to the given style property.
|
---|
1889 | * If the result of evaluation is null, the corresponding style is removed.
|
---|
1890 | *
|
---|
1891 | * @publicApi
|
---|
1892 | */
|
---|
1893 | export declare class NgStyle implements DoCheck {
|
---|
1894 | private _ngEl;
|
---|
1895 | private _differs;
|
---|
1896 | private _renderer;
|
---|
1897 | private _ngStyle;
|
---|
1898 | private _differ;
|
---|
1899 | constructor(_ngEl: ElementRef, _differs: KeyValueDiffers, _renderer: Renderer2);
|
---|
1900 | set ngStyle(values: {
|
---|
1901 | [klass: string]: any;
|
---|
1902 | } | null);
|
---|
1903 | ngDoCheck(): void;
|
---|
1904 | private _setStyle;
|
---|
1905 | private _applyChanges;
|
---|
1906 | }
|
---|
1907 |
|
---|
1908 | /**
|
---|
1909 | * @ngModule CommonModule
|
---|
1910 | *
|
---|
1911 | * @description
|
---|
1912 | * The `[ngSwitch]` directive on a container specifies an expression to match against.
|
---|
1913 | * The expressions to match are provided by `ngSwitchCase` directives on views within the container.
|
---|
1914 | * - Every view that matches is rendered.
|
---|
1915 | * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered.
|
---|
1916 | * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase`
|
---|
1917 | * or `ngSwitchDefault` directive are preserved at the location.
|
---|
1918 | *
|
---|
1919 | * @usageNotes
|
---|
1920 | * Define a container element for the directive, and specify the switch expression
|
---|
1921 | * to match against as an attribute:
|
---|
1922 | *
|
---|
1923 | * ```
|
---|
1924 | * <container-element [ngSwitch]="switch_expression">
|
---|
1925 | * ```
|
---|
1926 | *
|
---|
1927 | * Within the container, `*ngSwitchCase` statements specify the match expressions
|
---|
1928 | * as attributes. Include `*ngSwitchDefault` as the final case.
|
---|
1929 | *
|
---|
1930 | * ```
|
---|
1931 | * <container-element [ngSwitch]="switch_expression">
|
---|
1932 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
---|
1933 | * ...
|
---|
1934 | * <some-element *ngSwitchDefault>...</some-element>
|
---|
1935 | * </container-element>
|
---|
1936 | * ```
|
---|
1937 | *
|
---|
1938 | * ### Usage Examples
|
---|
1939 | *
|
---|
1940 | * The following example shows how to use more than one case to display the same view:
|
---|
1941 | *
|
---|
1942 | * ```
|
---|
1943 | * <container-element [ngSwitch]="switch_expression">
|
---|
1944 | * <!-- the same view can be shown in more than one case -->
|
---|
1945 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
---|
1946 | * <some-element *ngSwitchCase="match_expression_2">...</some-element>
|
---|
1947 | * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
|
---|
1948 | * <!--default case when there are no matches -->
|
---|
1949 | * <some-element *ngSwitchDefault>...</some-element>
|
---|
1950 | * </container-element>
|
---|
1951 | * ```
|
---|
1952 | *
|
---|
1953 | * The following example shows how cases can be nested:
|
---|
1954 | * ```
|
---|
1955 | * <container-element [ngSwitch]="switch_expression">
|
---|
1956 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
---|
1957 | * <some-element *ngSwitchCase="match_expression_2">...</some-element>
|
---|
1958 | * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
|
---|
1959 | * <ng-container *ngSwitchCase="match_expression_3">
|
---|
1960 | * <!-- use a ng-container to group multiple root nodes -->
|
---|
1961 | * <inner-element></inner-element>
|
---|
1962 | * <inner-other-element></inner-other-element>
|
---|
1963 | * </ng-container>
|
---|
1964 | * <some-element *ngSwitchDefault>...</some-element>
|
---|
1965 | * </container-element>
|
---|
1966 | * ```
|
---|
1967 | *
|
---|
1968 | * @publicApi
|
---|
1969 | * @see `NgSwitchCase`
|
---|
1970 | * @see `NgSwitchDefault`
|
---|
1971 | * @see [Structural Directives](guide/structural-directives)
|
---|
1972 | *
|
---|
1973 | */
|
---|
1974 | export declare class NgSwitch {
|
---|
1975 | private _defaultViews;
|
---|
1976 | private _defaultUsed;
|
---|
1977 | private _caseCount;
|
---|
1978 | private _lastCaseCheckIndex;
|
---|
1979 | private _lastCasesMatched;
|
---|
1980 | private _ngSwitch;
|
---|
1981 | set ngSwitch(newValue: any);
|
---|
1982 | private _updateDefaultCases;
|
---|
1983 | }
|
---|
1984 |
|
---|
1985 | /**
|
---|
1986 | * @ngModule CommonModule
|
---|
1987 | *
|
---|
1988 | * @description
|
---|
1989 | * Provides a switch case expression to match against an enclosing `ngSwitch` expression.
|
---|
1990 | * When the expressions match, the given `NgSwitchCase` template is rendered.
|
---|
1991 | * If multiple match expressions match the switch expression value, all of them are displayed.
|
---|
1992 | *
|
---|
1993 | * @usageNotes
|
---|
1994 | *
|
---|
1995 | * Within a switch container, `*ngSwitchCase` statements specify the match expressions
|
---|
1996 | * as attributes. Include `*ngSwitchDefault` as the final case.
|
---|
1997 | *
|
---|
1998 | * ```
|
---|
1999 | * <container-element [ngSwitch]="switch_expression">
|
---|
2000 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
---|
2001 | * ...
|
---|
2002 | * <some-element *ngSwitchDefault>...</some-element>
|
---|
2003 | * </container-element>
|
---|
2004 | * ```
|
---|
2005 | *
|
---|
2006 | * Each switch-case statement contains an in-line HTML template or template reference
|
---|
2007 | * that defines the subtree to be selected if the value of the match expression
|
---|
2008 | * matches the value of the switch expression.
|
---|
2009 | *
|
---|
2010 | * Unlike JavaScript, which uses strict equality, Angular uses loose equality.
|
---|
2011 | * This means that the empty string, `""` matches 0.
|
---|
2012 | *
|
---|
2013 | * @publicApi
|
---|
2014 | * @see `NgSwitch`
|
---|
2015 | * @see `NgSwitchDefault`
|
---|
2016 | *
|
---|
2017 | */
|
---|
2018 | export declare class NgSwitchCase implements DoCheck {
|
---|
2019 | private ngSwitch;
|
---|
2020 | private _view;
|
---|
2021 | /**
|
---|
2022 | * Stores the HTML template to be selected on match.
|
---|
2023 | */
|
---|
2024 | ngSwitchCase: any;
|
---|
2025 | constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
|
---|
2026 | /**
|
---|
2027 | * Performs case matching. For internal use only.
|
---|
2028 | */
|
---|
2029 | ngDoCheck(): void;
|
---|
2030 | }
|
---|
2031 |
|
---|
2032 | /**
|
---|
2033 | * @ngModule CommonModule
|
---|
2034 | *
|
---|
2035 | * @description
|
---|
2036 | *
|
---|
2037 | * Creates a view that is rendered when no `NgSwitchCase` expressions
|
---|
2038 | * match the `NgSwitch` expression.
|
---|
2039 | * This statement should be the final case in an `NgSwitch`.
|
---|
2040 | *
|
---|
2041 | * @publicApi
|
---|
2042 | * @see `NgSwitch`
|
---|
2043 | * @see `NgSwitchCase`
|
---|
2044 | *
|
---|
2045 | */
|
---|
2046 | export declare class NgSwitchDefault {
|
---|
2047 | constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
|
---|
2048 | }
|
---|
2049 |
|
---|
2050 | /**
|
---|
2051 | * @ngModule CommonModule
|
---|
2052 | *
|
---|
2053 | * @description
|
---|
2054 | *
|
---|
2055 | * Inserts an embedded view from a prepared `TemplateRef`.
|
---|
2056 | *
|
---|
2057 | * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
|
---|
2058 | * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
|
---|
2059 | * by the local template `let` declarations.
|
---|
2060 | *
|
---|
2061 | * @usageNotes
|
---|
2062 | * ```
|
---|
2063 | * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
|
---|
2064 | * ```
|
---|
2065 | *
|
---|
2066 | * Using the key `$implicit` in the context object will set its value as default.
|
---|
2067 | *
|
---|
2068 | * ### Example
|
---|
2069 | *
|
---|
2070 | * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
|
---|
2071 | *
|
---|
2072 | * @publicApi
|
---|
2073 | */
|
---|
2074 | export declare class NgTemplateOutlet implements OnChanges {
|
---|
2075 | private _viewContainerRef;
|
---|
2076 | private _viewRef;
|
---|
2077 | /**
|
---|
2078 | * A context object to attach to the {@link EmbeddedViewRef}. This should be an
|
---|
2079 | * object, the object's keys will be available for binding by the local template `let`
|
---|
2080 | * declarations.
|
---|
2081 | * Using the key `$implicit` in the context object will set its value as default.
|
---|
2082 | */
|
---|
2083 | ngTemplateOutletContext: Object | null;
|
---|
2084 | /**
|
---|
2085 | * A string defining the template reference and optionally the context object for the template.
|
---|
2086 | */
|
---|
2087 | ngTemplateOutlet: TemplateRef<any> | null;
|
---|
2088 | constructor(_viewContainerRef: ViewContainerRef);
|
---|
2089 | ngOnChanges(changes: SimpleChanges): void;
|
---|
2090 | }
|
---|
2091 |
|
---|
2092 |
|
---|
2093 | /**
|
---|
2094 | * Format styles that can be used to represent numbers.
|
---|
2095 | * @see `getLocaleNumberFormat()`.
|
---|
2096 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
2097 | *
|
---|
2098 | * @publicApi
|
---|
2099 | */
|
---|
2100 | export declare enum NumberFormatStyle {
|
---|
2101 | Decimal = 0,
|
---|
2102 | Percent = 1,
|
---|
2103 | Currency = 2,
|
---|
2104 | Scientific = 3
|
---|
2105 | }
|
---|
2106 |
|
---|
2107 | /**
|
---|
2108 | * Symbols that can be used to replace placeholders in number patterns.
|
---|
2109 | * Examples are based on `en-US` values.
|
---|
2110 | *
|
---|
2111 | * @see `getLocaleNumberSymbol()`
|
---|
2112 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
2113 | *
|
---|
2114 | * @publicApi
|
---|
2115 | */
|
---|
2116 | export declare enum NumberSymbol {
|
---|
2117 | /**
|
---|
2118 | * Decimal separator.
|
---|
2119 | * For `en-US`, the dot character.
|
---|
2120 | * Example: 2,345`.`67
|
---|
2121 | */
|
---|
2122 | Decimal = 0,
|
---|
2123 | /**
|
---|
2124 | * Grouping separator, typically for thousands.
|
---|
2125 | * For `en-US`, the comma character.
|
---|
2126 | * Example: 2`,`345.67
|
---|
2127 | */
|
---|
2128 | Group = 1,
|
---|
2129 | /**
|
---|
2130 | * List-item separator.
|
---|
2131 | * Example: "one, two, and three"
|
---|
2132 | */
|
---|
2133 | List = 2,
|
---|
2134 | /**
|
---|
2135 | * Sign for percentage (out of 100).
|
---|
2136 | * Example: 23.4%
|
---|
2137 | */
|
---|
2138 | PercentSign = 3,
|
---|
2139 | /**
|
---|
2140 | * Sign for positive numbers.
|
---|
2141 | * Example: +23
|
---|
2142 | */
|
---|
2143 | PlusSign = 4,
|
---|
2144 | /**
|
---|
2145 | * Sign for negative numbers.
|
---|
2146 | * Example: -23
|
---|
2147 | */
|
---|
2148 | MinusSign = 5,
|
---|
2149 | /**
|
---|
2150 | * Computer notation for exponential value (n times a power of 10).
|
---|
2151 | * Example: 1.2E3
|
---|
2152 | */
|
---|
2153 | Exponential = 6,
|
---|
2154 | /**
|
---|
2155 | * Human-readable format of exponential.
|
---|
2156 | * Example: 1.2x103
|
---|
2157 | */
|
---|
2158 | SuperscriptingExponent = 7,
|
---|
2159 | /**
|
---|
2160 | * Sign for permille (out of 1000).
|
---|
2161 | * Example: 23.4‰
|
---|
2162 | */
|
---|
2163 | PerMille = 8,
|
---|
2164 | /**
|
---|
2165 | * Infinity, can be used with plus and minus.
|
---|
2166 | * Example: ∞, +∞, -∞
|
---|
2167 | */
|
---|
2168 | Infinity = 9,
|
---|
2169 | /**
|
---|
2170 | * Not a number.
|
---|
2171 | * Example: NaN
|
---|
2172 | */
|
---|
2173 | NaN = 10,
|
---|
2174 | /**
|
---|
2175 | * Symbol used between time units.
|
---|
2176 | * Example: 10:52
|
---|
2177 | */
|
---|
2178 | TimeSeparator = 11,
|
---|
2179 | /**
|
---|
2180 | * Decimal separator for currency values (fallback to `Decimal`).
|
---|
2181 | * Example: $2,345.67
|
---|
2182 | */
|
---|
2183 | CurrencyDecimal = 12,
|
---|
2184 | /**
|
---|
2185 | * Group separator for currency values (fallback to `Group`).
|
---|
2186 | * Example: $2,345.67
|
---|
2187 | */
|
---|
2188 | CurrencyGroup = 13
|
---|
2189 | }
|
---|
2190 |
|
---|
2191 | /**
|
---|
2192 | * @description
|
---|
2193 | * A {@link LocationStrategy} used to configure the {@link Location} service to
|
---|
2194 | * represent its state in the
|
---|
2195 | * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
|
---|
2196 | * browser's URL.
|
---|
2197 | *
|
---|
2198 | * If you're using `PathLocationStrategy`, you must provide a {@link APP_BASE_HREF}
|
---|
2199 | * or add a `<base href>` element to the document.
|
---|
2200 | *
|
---|
2201 | * For instance, if you provide an `APP_BASE_HREF` of `'/my/app/'` and call
|
---|
2202 | * `location.go('/foo')`, the browser's URL will become
|
---|
2203 | * `example.com/my/app/foo`. To ensure all relative URIs resolve correctly,
|
---|
2204 | * the `<base href>` and/or `APP_BASE_HREF` should end with a `/`.
|
---|
2205 | *
|
---|
2206 | * Similarly, if you add `<base href='/my/app/'/>` to the document and call
|
---|
2207 | * `location.go('/foo')`, the browser's URL will become
|
---|
2208 | * `example.com/my/app/foo`.
|
---|
2209 | *
|
---|
2210 | * Note that when using `PathLocationStrategy`, neither the query nor
|
---|
2211 | * the fragment in the `<base href>` will be preserved, as outlined
|
---|
2212 | * by the [RFC](https://tools.ietf.org/html/rfc3986#section-5.2.2).
|
---|
2213 | *
|
---|
2214 | * @usageNotes
|
---|
2215 | *
|
---|
2216 | * ### Example
|
---|
2217 | *
|
---|
2218 | * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
|
---|
2219 | *
|
---|
2220 | * @publicApi
|
---|
2221 | */
|
---|
2222 | export declare class PathLocationStrategy extends LocationStrategy implements OnDestroy {
|
---|
2223 | private _platformLocation;
|
---|
2224 | private _baseHref;
|
---|
2225 | private _removeListenerFns;
|
---|
2226 | constructor(_platformLocation: PlatformLocation, href?: string);
|
---|
2227 | ngOnDestroy(): void;
|
---|
2228 | onPopState(fn: LocationChangeListener): void;
|
---|
2229 | getBaseHref(): string;
|
---|
2230 | prepareExternalUrl(internal: string): string;
|
---|
2231 | path(includeHash?: boolean): string;
|
---|
2232 | pushState(state: any, title: string, url: string, queryParams: string): void;
|
---|
2233 | replaceState(state: any, title: string, url: string, queryParams: string): void;
|
---|
2234 | forward(): void;
|
---|
2235 | back(): void;
|
---|
2236 | historyGo(relativePosition?: number): void;
|
---|
2237 | }
|
---|
2238 |
|
---|
2239 | /**
|
---|
2240 | * @ngModule CommonModule
|
---|
2241 | * @description
|
---|
2242 | *
|
---|
2243 | * Transforms a number to a percentage
|
---|
2244 | * string, formatted according to locale rules that determine group sizing and
|
---|
2245 | * separator, decimal-point character, and other locale-specific
|
---|
2246 | * configurations.
|
---|
2247 | *
|
---|
2248 | * @see `formatPercent()`
|
---|
2249 | *
|
---|
2250 | * @usageNotes
|
---|
2251 | * The following code shows how the pipe transforms numbers
|
---|
2252 | * into text strings, according to various format specifications,
|
---|
2253 | * where the caller's default locale is `en-US`.
|
---|
2254 | *
|
---|
2255 | * <code-example path="common/pipes/ts/percent_pipe.ts" region='PercentPipe'></code-example>
|
---|
2256 | *
|
---|
2257 | * @publicApi
|
---|
2258 | */
|
---|
2259 | export declare class PercentPipe implements PipeTransform {
|
---|
2260 | private _locale;
|
---|
2261 | constructor(_locale: string);
|
---|
2262 | transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
|
---|
2263 | transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
|
---|
2264 | transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
|
---|
2265 | }
|
---|
2266 |
|
---|
2267 | /**
|
---|
2268 | * This class should not be used directly by an application developer. Instead, use
|
---|
2269 | * {@link Location}.
|
---|
2270 | *
|
---|
2271 | * `PlatformLocation` encapsulates all calls to DOM APIs, which allows the Router to be
|
---|
2272 | * platform-agnostic.
|
---|
2273 | * This means that we can have different implementation of `PlatformLocation` for the different
|
---|
2274 | * platforms that Angular supports. For example, `@angular/platform-browser` provides an
|
---|
2275 | * implementation specific to the browser environment, while `@angular/platform-server` provides
|
---|
2276 | * one suitable for use with server-side rendering.
|
---|
2277 | *
|
---|
2278 | * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy}
|
---|
2279 | * when they need to interact with the DOM APIs like pushState, popState, etc.
|
---|
2280 | *
|
---|
2281 | * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly
|
---|
2282 | * by the {@link Router} in order to navigate between routes. Since all interactions between {@link
|
---|
2283 | * Router} /
|
---|
2284 | * {@link Location} / {@link LocationStrategy} and DOM APIs flow through the `PlatformLocation`
|
---|
2285 | * class, they are all platform-agnostic.
|
---|
2286 | *
|
---|
2287 | * @publicApi
|
---|
2288 | */
|
---|
2289 | export declare abstract class PlatformLocation {
|
---|
2290 | abstract getBaseHrefFromDOM(): string;
|
---|
2291 | abstract getState(): unknown;
|
---|
2292 | /**
|
---|
2293 | * Returns a function that, when executed, removes the `popstate` event handler.
|
---|
2294 | */
|
---|
2295 | abstract onPopState(fn: LocationChangeListener): VoidFunction;
|
---|
2296 | /**
|
---|
2297 | * Returns a function that, when executed, removes the `hashchange` event handler.
|
---|
2298 | */
|
---|
2299 | abstract onHashChange(fn: LocationChangeListener): VoidFunction;
|
---|
2300 | abstract get href(): string;
|
---|
2301 | abstract get protocol(): string;
|
---|
2302 | abstract get hostname(): string;
|
---|
2303 | abstract get port(): string;
|
---|
2304 | abstract get pathname(): string;
|
---|
2305 | abstract get search(): string;
|
---|
2306 | abstract get hash(): string;
|
---|
2307 | abstract replaceState(state: any, title: string, url: string): void;
|
---|
2308 | abstract pushState(state: any, title: string, url: string): void;
|
---|
2309 | abstract forward(): void;
|
---|
2310 | abstract back(): void;
|
---|
2311 | historyGo?(relativePosition: number): void;
|
---|
2312 | }
|
---|
2313 |
|
---|
2314 | /**
|
---|
2315 | * Plurality cases used for translating plurals to different languages.
|
---|
2316 | *
|
---|
2317 | * @see `NgPlural`
|
---|
2318 | * @see `NgPluralCase`
|
---|
2319 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
|
---|
2320 | *
|
---|
2321 | * @publicApi
|
---|
2322 | */
|
---|
2323 | export declare enum Plural {
|
---|
2324 | Zero = 0,
|
---|
2325 | One = 1,
|
---|
2326 | Two = 2,
|
---|
2327 | Few = 3,
|
---|
2328 | Many = 4,
|
---|
2329 | Other = 5
|
---|
2330 | }
|
---|
2331 |
|
---|
2332 | /** @publicApi */
|
---|
2333 | declare interface PopStateEvent_2 {
|
---|
2334 | pop?: boolean;
|
---|
2335 | state?: any;
|
---|
2336 | type?: string;
|
---|
2337 | url?: string;
|
---|
2338 | }
|
---|
2339 | export { PopStateEvent_2 as PopStateEvent }
|
---|
2340 |
|
---|
2341 |
|
---|
2342 | /**
|
---|
2343 | * Register global data to be used internally by Angular. See the
|
---|
2344 | * ["I18n guide"](guide/i18n-common-format-data-locale) to know how to import additional locale
|
---|
2345 | * data.
|
---|
2346 | *
|
---|
2347 | * The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1
|
---|
2348 | *
|
---|
2349 | * @publicApi
|
---|
2350 | */
|
---|
2351 | export declare function registerLocaleData(data: any, localeId?: string | any, extraData?: any): void;
|
---|
2352 |
|
---|
2353 | /**
|
---|
2354 | * @ngModule CommonModule
|
---|
2355 | * @description
|
---|
2356 | *
|
---|
2357 | * Creates a new `Array` or `String` containing a subset (slice) of the elements.
|
---|
2358 | *
|
---|
2359 | * @usageNotes
|
---|
2360 | *
|
---|
2361 | * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
|
---|
2362 | * and `String.prototype.slice()`.
|
---|
2363 | *
|
---|
2364 | * When operating on an `Array`, the returned `Array` is always a copy even when all
|
---|
2365 | * the elements are being returned.
|
---|
2366 | *
|
---|
2367 | * When operating on a blank value, the pipe returns the blank value.
|
---|
2368 | *
|
---|
2369 | * ### List Example
|
---|
2370 | *
|
---|
2371 | * This `ngFor` example:
|
---|
2372 | *
|
---|
2373 | * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
|
---|
2374 | *
|
---|
2375 | * produces the following:
|
---|
2376 | *
|
---|
2377 | * ```html
|
---|
2378 | * <li>b</li>
|
---|
2379 | * <li>c</li>
|
---|
2380 | * ```
|
---|
2381 | *
|
---|
2382 | * ### String Examples
|
---|
2383 | *
|
---|
2384 | * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
|
---|
2385 | *
|
---|
2386 | * @publicApi
|
---|
2387 | */
|
---|
2388 | export declare class SlicePipe implements PipeTransform {
|
---|
2389 | /**
|
---|
2390 | * @param value a list or a string to be sliced.
|
---|
2391 | * @param start the starting index of the subset to return:
|
---|
2392 | * - **a positive integer**: return the item at `start` index and all items after
|
---|
2393 | * in the list or string expression.
|
---|
2394 | * - **a negative integer**: return the item at `start` index from the end and all items after
|
---|
2395 | * in the list or string expression.
|
---|
2396 | * - **if positive and greater than the size of the expression**: return an empty list or
|
---|
2397 | * string.
|
---|
2398 | * - **if negative and greater than the size of the expression**: return entire list or string.
|
---|
2399 | * @param end the ending index of the subset to return:
|
---|
2400 | * - **omitted**: return all items until the end.
|
---|
2401 | * - **if positive**: return all items before `end` index of the list or string.
|
---|
2402 | * - **if negative**: return all items before `end` index from the end of the list or string.
|
---|
2403 | */
|
---|
2404 | transform<T>(value: ReadonlyArray<T>, start: number, end?: number): Array<T>;
|
---|
2405 | transform(value: null | undefined, start: number, end?: number): null;
|
---|
2406 | transform<T>(value: ReadonlyArray<T> | null | undefined, start: number, end?: number): Array<T> | null;
|
---|
2407 | transform(value: string, start: number, end?: number): string;
|
---|
2408 | transform(value: string | null | undefined, start: number, end?: number): string | null;
|
---|
2409 | private supports;
|
---|
2410 | }
|
---|
2411 |
|
---|
2412 | declare class SwitchView {
|
---|
2413 | private _viewContainerRef;
|
---|
2414 | private _templateRef;
|
---|
2415 | private _created;
|
---|
2416 | constructor(_viewContainerRef: ViewContainerRef, _templateRef: TemplateRef<Object>);
|
---|
2417 | create(): void;
|
---|
2418 | destroy(): void;
|
---|
2419 | enforceState(created: boolean): void;
|
---|
2420 | }
|
---|
2421 |
|
---|
2422 | /**
|
---|
2423 | * Represents a time value with hours and minutes.
|
---|
2424 | *
|
---|
2425 | * @publicApi
|
---|
2426 | */
|
---|
2427 | export declare type Time = {
|
---|
2428 | hours: number;
|
---|
2429 | minutes: number;
|
---|
2430 | };
|
---|
2431 |
|
---|
2432 | /**
|
---|
2433 | * Transforms text to title case.
|
---|
2434 | * Capitalizes the first letter of each word and transforms the
|
---|
2435 | * rest of the word to lower case.
|
---|
2436 | * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.
|
---|
2437 | *
|
---|
2438 | * @see `LowerCasePipe`
|
---|
2439 | * @see `UpperCasePipe`
|
---|
2440 | *
|
---|
2441 | * @usageNotes
|
---|
2442 | * The following example shows the result of transforming various strings into title case.
|
---|
2443 | *
|
---|
2444 | * <code-example path="common/pipes/ts/titlecase_pipe.ts" region='TitleCasePipe'></code-example>
|
---|
2445 | *
|
---|
2446 | * @ngModule CommonModule
|
---|
2447 | * @publicApi
|
---|
2448 | */
|
---|
2449 | export declare class TitleCasePipe implements PipeTransform {
|
---|
2450 | /**
|
---|
2451 | * @param value The string to transform to title case.
|
---|
2452 | */
|
---|
2453 | transform(value: string): string;
|
---|
2454 | transform(value: null | undefined): null;
|
---|
2455 | transform(value: string | null | undefined): string | null;
|
---|
2456 | }
|
---|
2457 |
|
---|
2458 | /**
|
---|
2459 | * String widths available for translations.
|
---|
2460 | * The specific character widths are locale-specific.
|
---|
2461 | * Examples are given for the word "Sunday" in English.
|
---|
2462 | *
|
---|
2463 | * @publicApi
|
---|
2464 | */
|
---|
2465 | export declare enum TranslationWidth {
|
---|
2466 | /** 1 character for `en-US`. For example: 'S' */
|
---|
2467 | Narrow = 0,
|
---|
2468 | /** 3 characters for `en-US`. For example: 'Sun' */
|
---|
2469 | Abbreviated = 1,
|
---|
2470 | /** Full length for `en-US`. For example: "Sunday" */
|
---|
2471 | Wide = 2,
|
---|
2472 | /** 2 characters for `en-US`, For example: "Su" */
|
---|
2473 | Short = 3
|
---|
2474 | }
|
---|
2475 |
|
---|
2476 | /**
|
---|
2477 | * Transforms text to all upper case.
|
---|
2478 | * @see `LowerCasePipe`
|
---|
2479 | * @see `TitleCasePipe`
|
---|
2480 | *
|
---|
2481 | * @ngModule CommonModule
|
---|
2482 | * @publicApi
|
---|
2483 | */
|
---|
2484 | export declare class UpperCasePipe implements PipeTransform {
|
---|
2485 | /**
|
---|
2486 | * @param value The string to transform to upper case.
|
---|
2487 | */
|
---|
2488 | transform(value: string): string;
|
---|
2489 | transform(value: null | undefined): null;
|
---|
2490 | transform(value: string | null | undefined): string | null;
|
---|
2491 | }
|
---|
2492 |
|
---|
2493 | /**
|
---|
2494 | * @publicApi
|
---|
2495 | */
|
---|
2496 | export declare const VERSION: Version;
|
---|
2497 |
|
---|
2498 |
|
---|
2499 | /**
|
---|
2500 | * Defines a scroll position manager. Implemented by `BrowserViewportScroller`.
|
---|
2501 | *
|
---|
2502 | * @publicApi
|
---|
2503 | */
|
---|
2504 | export declare abstract class ViewportScroller {
|
---|
2505 | /** @nocollapse */
|
---|
2506 | static ɵprov: unknown;
|
---|
2507 | /**
|
---|
2508 | * Configures the top offset used when scrolling to an anchor.
|
---|
2509 | * @param offset A position in screen coordinates (a tuple with x and y values)
|
---|
2510 | * or a function that returns the top offset position.
|
---|
2511 | *
|
---|
2512 | */
|
---|
2513 | abstract setOffset(offset: [number, number] | (() => [number, number])): void;
|
---|
2514 | /**
|
---|
2515 | * Retrieves the current scroll position.
|
---|
2516 | * @returns A position in screen coordinates (a tuple with x and y values).
|
---|
2517 | */
|
---|
2518 | abstract getScrollPosition(): [number, number];
|
---|
2519 | /**
|
---|
2520 | * Scrolls to a specified position.
|
---|
2521 | * @param position A position in screen coordinates (a tuple with x and y values).
|
---|
2522 | */
|
---|
2523 | abstract scrollToPosition(position: [number, number]): void;
|
---|
2524 | /**
|
---|
2525 | * Scrolls to an anchor element.
|
---|
2526 | * @param anchor The ID of the anchor element.
|
---|
2527 | */
|
---|
2528 | abstract scrollToAnchor(anchor: string): void;
|
---|
2529 | /**
|
---|
2530 | * Disables automatic scroll restoration provided by the browser.
|
---|
2531 | * See also [window.history.scrollRestoration
|
---|
2532 | * info](https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration).
|
---|
2533 | */
|
---|
2534 | abstract setHistoryScrollRestoration(scrollRestoration: 'auto' | 'manual'): void;
|
---|
2535 | }
|
---|
2536 |
|
---|
2537 | /**
|
---|
2538 | * The value for each day of the week, based on the `en-US` locale
|
---|
2539 | *
|
---|
2540 | * @publicApi
|
---|
2541 | */
|
---|
2542 | export declare enum WeekDay {
|
---|
2543 | Sunday = 0,
|
---|
2544 | Monday = 1,
|
---|
2545 | Tuesday = 2,
|
---|
2546 | Wednesday = 3,
|
---|
2547 | Thursday = 4,
|
---|
2548 | Friday = 5,
|
---|
2549 | Saturday = 6
|
---|
2550 | }
|
---|
2551 |
|
---|
2552 |
|
---|
2553 | /**
|
---|
2554 | * A wrapper around the `XMLHttpRequest` constructor.
|
---|
2555 | *
|
---|
2556 | * @publicApi
|
---|
2557 | */
|
---|
2558 | export declare abstract class XhrFactory {
|
---|
2559 | abstract build(): XMLHttpRequest;
|
---|
2560 | }
|
---|
2561 |
|
---|
2562 | export declare function ɵangular_packages_common_common_a(): ɵBrowserPlatformLocation;
|
---|
2563 |
|
---|
2564 | export declare function ɵangular_packages_common_common_b(): ɵBrowserPlatformLocation;
|
---|
2565 |
|
---|
2566 | export declare function ɵangular_packages_common_common_c(): Location_2;
|
---|
2567 |
|
---|
2568 | export declare function ɵangular_packages_common_common_d(platformLocation: PlatformLocation): PathLocationStrategy;
|
---|
2569 |
|
---|
2570 | /**
|
---|
2571 | * A collection of Angular directives that are likely to be used in each and every Angular
|
---|
2572 | * application.
|
---|
2573 | */
|
---|
2574 | export declare const ɵangular_packages_common_common_e: Provider[];
|
---|
2575 |
|
---|
2576 | /**
|
---|
2577 | * A collection of Angular pipes that are likely to be used in each and every application.
|
---|
2578 | */
|
---|
2579 | export declare const ɵangular_packages_common_common_f: (typeof AsyncPipe | typeof SlicePipe | typeof DecimalPipe | typeof PercentPipe | typeof CurrencyPipe | typeof DatePipe | typeof I18nPluralPipe | typeof I18nSelectPipe | typeof KeyValuePipe)[];
|
---|
2580 |
|
---|
2581 | /**
|
---|
2582 | * `PlatformLocation` encapsulates all of the direct calls to platform APIs.
|
---|
2583 | * This class should not be used directly by an application developer. Instead, use
|
---|
2584 | * {@link Location}.
|
---|
2585 | */
|
---|
2586 | export declare class ɵBrowserPlatformLocation extends PlatformLocation {
|
---|
2587 | private _doc;
|
---|
2588 | readonly location: Location;
|
---|
2589 | private _history;
|
---|
2590 | constructor(_doc: any);
|
---|
2591 | getBaseHrefFromDOM(): string;
|
---|
2592 | onPopState(fn: LocationChangeListener): VoidFunction;
|
---|
2593 | onHashChange(fn: LocationChangeListener): VoidFunction;
|
---|
2594 | get href(): string;
|
---|
2595 | get protocol(): string;
|
---|
2596 | get hostname(): string;
|
---|
2597 | get port(): string;
|
---|
2598 | get pathname(): string;
|
---|
2599 | get search(): string;
|
---|
2600 | get hash(): string;
|
---|
2601 | set pathname(newPath: string);
|
---|
2602 | pushState(state: any, title: string, url: string): void;
|
---|
2603 | replaceState(state: any, title: string, url: string): void;
|
---|
2604 | forward(): void;
|
---|
2605 | back(): void;
|
---|
2606 | historyGo(relativePosition?: number): void;
|
---|
2607 | getState(): unknown;
|
---|
2608 | }
|
---|
2609 |
|
---|
2610 | /**
|
---|
2611 | * Provides DOM operations in an environment-agnostic way.
|
---|
2612 | *
|
---|
2613 | * @security Tread carefully! Interacting with the DOM directly is dangerous and
|
---|
2614 | * can introduce XSS risks.
|
---|
2615 | */
|
---|
2616 | export declare abstract class ɵDomAdapter {
|
---|
2617 | abstract dispatchEvent(el: any, evt: any): any;
|
---|
2618 | abstract readonly supportsDOMEvents: boolean;
|
---|
2619 | abstract remove(el: any): void;
|
---|
2620 | abstract createElement(tagName: any, doc?: any): HTMLElement;
|
---|
2621 | abstract createHtmlDocument(): HTMLDocument;
|
---|
2622 | abstract getDefaultDocument(): Document;
|
---|
2623 | abstract isElementNode(node: any): boolean;
|
---|
2624 | abstract isShadowRoot(node: any): boolean;
|
---|
2625 | abstract onAndCancel(el: any, evt: any, listener: any): Function;
|
---|
2626 | abstract getGlobalEventTarget(doc: Document, target: string): any;
|
---|
2627 | abstract getBaseHref(doc: Document): string | null;
|
---|
2628 | abstract resetBaseElement(): void;
|
---|
2629 | abstract getUserAgent(): string;
|
---|
2630 | abstract getCookie(name: string): string | null;
|
---|
2631 | }
|
---|
2632 |
|
---|
2633 |
|
---|
2634 | export declare function ɵgetDOM(): ɵDomAdapter;
|
---|
2635 |
|
---|
2636 | /**
|
---|
2637 | * Provides an empty implementation of the viewport scroller.
|
---|
2638 | */
|
---|
2639 | export declare class ɵNullViewportScroller implements ViewportScroller {
|
---|
2640 | /**
|
---|
2641 | * Empty implementation
|
---|
2642 | */
|
---|
2643 | setOffset(offset: [number, number] | (() => [number, number])): void;
|
---|
2644 | /**
|
---|
2645 | * Empty implementation
|
---|
2646 | */
|
---|
2647 | getScrollPosition(): [number, number];
|
---|
2648 | /**
|
---|
2649 | * Empty implementation
|
---|
2650 | */
|
---|
2651 | scrollToPosition(position: [number, number]): void;
|
---|
2652 | /**
|
---|
2653 | * Empty implementation
|
---|
2654 | */
|
---|
2655 | scrollToAnchor(anchor: string): void;
|
---|
2656 | /**
|
---|
2657 | * Empty implementation
|
---|
2658 | */
|
---|
2659 | setHistoryScrollRestoration(scrollRestoration: 'auto' | 'manual'): void;
|
---|
2660 | }
|
---|
2661 |
|
---|
2662 |
|
---|
2663 | export declare function ɵparseCookieValue(cookieStr: string, name: string): string | null;
|
---|
2664 |
|
---|
2665 |
|
---|
2666 | export declare const ɵPLATFORM_BROWSER_ID = "browser";
|
---|
2667 |
|
---|
2668 | export declare const ɵPLATFORM_SERVER_ID = "server";
|
---|
2669 |
|
---|
2670 | export declare const ɵPLATFORM_WORKER_APP_ID = "browserWorkerApp";
|
---|
2671 |
|
---|
2672 | export declare const ɵPLATFORM_WORKER_UI_ID = "browserWorkerUi";
|
---|
2673 |
|
---|
2674 | export declare function ɵsetRootDomAdapter(adapter: ɵDomAdapter): void;
|
---|
2675 |
|
---|
2676 | export { }
|
---|