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