@angular/common 19.2.4 → 19.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1937 @@
1
+ /**
2
+ * @license Angular v19.2.6
3
+ * (c) 2010-2025 Google LLC. https://angular.io/
4
+ * License: MIT
5
+ */
6
+
7
+ import * as i0 from '@angular/core';
8
+ import { InjectionToken, OnDestroy, DoCheck, ElementRef, Renderer2, OnChanges, Type, Injector, NgModuleFactory, ViewContainerRef, SimpleChanges, NgIterable, TrackByFunction, TemplateRef, IterableDiffers, KeyValueDiffers, PipeTransform, ChangeDetectorRef } from '@angular/core';
9
+ import { SubscriptionLike, Observable, Subscribable } from 'rxjs';
10
+ import { LocationChangeListener, PlatformLocation } from './platform_location.d-Lbv6Ueec.js';
11
+
12
+ /**
13
+ * Enables the `Location` service to read route state from the browser's URL.
14
+ * Angular provides two strategies:
15
+ * `HashLocationStrategy` and `PathLocationStrategy`.
16
+ *
17
+ * Applications should use the `Router` or `Location` services to
18
+ * interact with application route state.
19
+ *
20
+ * For instance, `HashLocationStrategy` produces URLs like
21
+ * <code class="no-auto-link">http://example.com/#/foo</code>,
22
+ * and `PathLocationStrategy` produces
23
+ * <code class="no-auto-link">http://example.com/foo</code> as an equivalent URL.
24
+ *
25
+ * See these two classes for more.
26
+ *
27
+ * @publicApi
28
+ */
29
+ declare abstract class LocationStrategy {
30
+ abstract path(includeHash?: boolean): string;
31
+ abstract prepareExternalUrl(internal: string): string;
32
+ abstract getState(): unknown;
33
+ abstract pushState(state: any, title: string, url: string, queryParams: string): void;
34
+ abstract replaceState(state: any, title: string, url: string, queryParams: string): void;
35
+ abstract forward(): void;
36
+ abstract back(): void;
37
+ historyGo?(relativePosition: number): void;
38
+ abstract onPopState(fn: LocationChangeListener): void;
39
+ abstract getBaseHref(): string;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocationStrategy, never>;
41
+ static ɵprov: i0.ɵɵInjectableDeclaration<LocationStrategy>;
42
+ }
43
+ /**
44
+ * A predefined DI token for the base href
45
+ * to be used with the `PathLocationStrategy`.
46
+ * The base href is the URL prefix that should be preserved when generating
47
+ * and recognizing URLs.
48
+ *
49
+ * @usageNotes
50
+ *
51
+ * The following example shows how to use this token to configure the root app injector
52
+ * with a base href value, so that the DI framework can supply the dependency anywhere in the app.
53
+ *
54
+ * ```ts
55
+ * import {NgModule} from '@angular/core';
56
+ * import {APP_BASE_HREF} from '@angular/common';
57
+ *
58
+ * @NgModule({
59
+ * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
60
+ * })
61
+ * class AppModule {}
62
+ * ```
63
+ *
64
+ * @publicApi
65
+ */
66
+ declare const APP_BASE_HREF: InjectionToken<string>;
67
+ /**
68
+ * @description
69
+ * A {@link LocationStrategy} used to configure the {@link Location} service to
70
+ * represent its state in the
71
+ * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
72
+ * browser's URL.
73
+ *
74
+ * If you're using `PathLocationStrategy`, you may provide a {@link APP_BASE_HREF}
75
+ * or add a `<base href>` element to the document to override the default.
76
+ *
77
+ * For instance, if you provide an `APP_BASE_HREF` of `'/my/app/'` and call
78
+ * `location.go('/foo')`, the browser's URL will become
79
+ * `example.com/my/app/foo`. To ensure all relative URIs resolve correctly,
80
+ * the `<base href>` and/or `APP_BASE_HREF` should end with a `/`.
81
+ *
82
+ * Similarly, if you add `<base href='/my/app/'/>` to the document and call
83
+ * `location.go('/foo')`, the browser's URL will become
84
+ * `example.com/my/app/foo`.
85
+ *
86
+ * Note that when using `PathLocationStrategy`, neither the query nor
87
+ * the fragment in the `<base href>` will be preserved, as outlined
88
+ * by the [RFC](https://tools.ietf.org/html/rfc3986#section-5.2.2).
89
+ *
90
+ * @usageNotes
91
+ *
92
+ * ### Example
93
+ *
94
+ * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
95
+ *
96
+ * @publicApi
97
+ */
98
+ declare class PathLocationStrategy extends LocationStrategy implements OnDestroy {
99
+ private _platformLocation;
100
+ private _baseHref;
101
+ private _removeListenerFns;
102
+ constructor(_platformLocation: PlatformLocation, href?: string);
103
+ /** @nodoc */
104
+ ngOnDestroy(): void;
105
+ onPopState(fn: LocationChangeListener): void;
106
+ getBaseHref(): string;
107
+ prepareExternalUrl(internal: string): string;
108
+ path(includeHash?: boolean): string;
109
+ pushState(state: any, title: string, url: string, queryParams: string): void;
110
+ replaceState(state: any, title: string, url: string, queryParams: string): void;
111
+ forward(): void;
112
+ back(): void;
113
+ getState(): unknown;
114
+ historyGo(relativePosition?: number): void;
115
+ static ɵfac: i0.ɵɵFactoryDeclaration<PathLocationStrategy, [null, { optional: true; }]>;
116
+ static ɵprov: i0.ɵɵInjectableDeclaration<PathLocationStrategy>;
117
+ }
118
+
119
+ /** @publicApi */
120
+ interface PopStateEvent {
121
+ pop?: boolean;
122
+ state?: any;
123
+ type?: string;
124
+ url?: string;
125
+ }
126
+ /**
127
+ * @description
128
+ *
129
+ * A service that applications can use to interact with a browser's URL.
130
+ *
131
+ * Depending on the `LocationStrategy` used, `Location` persists
132
+ * to the URL's path or the URL's hash segment.
133
+ *
134
+ * @usageNotes
135
+ *
136
+ * It's better to use the `Router.navigate()` service to trigger route changes. Use
137
+ * `Location` only if you need to interact with or create normalized URLs outside of
138
+ * routing.
139
+ *
140
+ * `Location` is responsible for normalizing the URL against the application's base href.
141
+ * A normalized URL is absolute from the URL host, includes the application's base href, and has no
142
+ * trailing slash:
143
+ * - `/my/app/user/123` is normalized
144
+ * - `my/app/user/123` **is not** normalized
145
+ * - `/my/app/user/123/` **is not** normalized
146
+ *
147
+ * ### Example
148
+ *
149
+ * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
150
+ *
151
+ * @publicApi
152
+ */
153
+ declare class Location implements OnDestroy {
154
+ constructor(locationStrategy: LocationStrategy);
155
+ /** @nodoc */
156
+ ngOnDestroy(): void;
157
+ /**
158
+ * Normalizes the URL path for this location.
159
+ *
160
+ * @param includeHash True to include an anchor fragment in the path.
161
+ *
162
+ * @returns The normalized URL path.
163
+ */
164
+ path(includeHash?: boolean): string;
165
+ /**
166
+ * Reports the current state of the location history.
167
+ * @returns The current value of the `history.state` object.
168
+ */
169
+ getState(): unknown;
170
+ /**
171
+ * Normalizes the given path and compares to the current normalized path.
172
+ *
173
+ * @param path The given URL path.
174
+ * @param query Query parameters.
175
+ *
176
+ * @returns True if the given URL path is equal to the current normalized path, false
177
+ * otherwise.
178
+ */
179
+ isCurrentPathEqualTo(path: string, query?: string): boolean;
180
+ /**
181
+ * Normalizes a URL path by stripping any trailing slashes.
182
+ *
183
+ * @param url String representing a URL.
184
+ *
185
+ * @returns The normalized URL string.
186
+ */
187
+ normalize(url: string): string;
188
+ /**
189
+ * Normalizes an external URL path.
190
+ * If the given URL doesn't begin with a leading slash (`'/'`), adds one
191
+ * before normalizing. Adds a hash if `HashLocationStrategy` is
192
+ * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
193
+ *
194
+ * @param url String representing a URL.
195
+ *
196
+ * @returns A normalized platform-specific URL.
197
+ */
198
+ prepareExternalUrl(url: string): string;
199
+ /**
200
+ * Changes the browser's URL to a normalized version of a given URL, and pushes a
201
+ * new item onto the platform's history.
202
+ *
203
+ * @param path URL path to normalize.
204
+ * @param query Query parameters.
205
+ * @param state Location history state.
206
+ *
207
+ */
208
+ go(path: string, query?: string, state?: any): void;
209
+ /**
210
+ * Changes the browser's URL to a normalized version of the given URL, and replaces
211
+ * the top item on the platform's history stack.
212
+ *
213
+ * @param path URL path to normalize.
214
+ * @param query Query parameters.
215
+ * @param state Location history state.
216
+ */
217
+ replaceState(path: string, query?: string, state?: any): void;
218
+ /**
219
+ * Navigates forward in the platform's history.
220
+ */
221
+ forward(): void;
222
+ /**
223
+ * Navigates back in the platform's history.
224
+ */
225
+ back(): void;
226
+ /**
227
+ * Navigate to a specific page from session history, identified by its relative position to the
228
+ * current page.
229
+ *
230
+ * @param relativePosition Position of the target page in the history relative to the current
231
+ * page.
232
+ * A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`
233
+ * moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go
234
+ * beyond what's stored in the history session, we stay in the current page. Same behaviour occurs
235
+ * when `relativePosition` equals 0.
236
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history
237
+ */
238
+ historyGo(relativePosition?: number): void;
239
+ /**
240
+ * Registers a URL change listener. Use to catch updates performed by the Angular
241
+ * framework that are not detectible through "popstate" or "hashchange" events.
242
+ *
243
+ * @param fn The change handler function, which take a URL and a location history state.
244
+ * @returns A function that, when executed, unregisters a URL change listener.
245
+ */
246
+ onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction;
247
+ /**
248
+ * Subscribes to the platform's `popState` events.
249
+ *
250
+ * Note: `Location.go()` does not trigger the `popState` event in the browser. Use
251
+ * `Location.onUrlChange()` to subscribe to URL changes instead.
252
+ *
253
+ * @param value Event that is triggered when the state history changes.
254
+ * @param exception The exception to throw.
255
+ *
256
+ * @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)
257
+ *
258
+ * @returns Subscribed events.
259
+ */
260
+ subscribe(onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
261
+ /**
262
+ * Normalizes URL parameters by prepending with `?` if needed.
263
+ *
264
+ * @param params String of URL parameters.
265
+ *
266
+ * @returns The normalized URL parameters string.
267
+ */
268
+ static normalizeQueryParams: (params: string) => string;
269
+ /**
270
+ * Joins two parts of a URL with a slash if needed.
271
+ *
272
+ * @param start URL string
273
+ * @param end URL string
274
+ *
275
+ *
276
+ * @returns The joined URL string.
277
+ */
278
+ static joinWithSlash: (start: string, end: string) => string;
279
+ /**
280
+ * Removes a trailing slash from a URL string if needed.
281
+ * Looks for the first occurrence of either `#`, `?`, or the end of the
282
+ * line as `/` characters and removes the trailing slash if one exists.
283
+ *
284
+ * @param url URL string.
285
+ *
286
+ * @returns The URL string, modified if needed.
287
+ */
288
+ static stripTrailingSlash: (url: string) => string;
289
+ static ɵfac: i0.ɵɵFactoryDeclaration<Location, never>;
290
+ static ɵprov: i0.ɵɵInjectableDeclaration<Location>;
291
+ }
292
+
293
+ /**
294
+ * @publicApi
295
+ */
296
+ declare abstract class NgLocalization {
297
+ abstract getPluralCategory(value: any, locale?: string): string;
298
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgLocalization, never>;
299
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgLocalization>;
300
+ }
301
+ /**
302
+ * Returns the plural case based on the locale
303
+ *
304
+ * @publicApi
305
+ */
306
+ declare class NgLocaleLocalization extends NgLocalization {
307
+ protected locale: string;
308
+ constructor(locale: string);
309
+ getPluralCategory(value: any, locale?: string): string;
310
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgLocaleLocalization, never>;
311
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgLocaleLocalization>;
312
+ }
313
+
314
+ /**
315
+ * @ngModule CommonModule
316
+ *
317
+ * @usageNotes
318
+ * ```html
319
+ * <some-element [ngClass]="stringExp|arrayExp|objExp|Set">...</some-element>
320
+ *
321
+ * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
322
+ * ```
323
+ *
324
+ * For more simple use cases you can use the [class bindings](/guide/templates/binding#css-class-and-style-property-bindings) directly.
325
+ * It doesn't require importing a directive.
326
+ *
327
+ * ```html
328
+ * <some-element [class]="'first second'">...</some-element>
329
+ *
330
+ * <some-element [class.expanded]="isExpanded">...</some-element>
331
+ *
332
+ * <some-element [class]="['first', 'second']">...</some-element>
333
+ *
334
+ * <some-element [class]="{'first': true, 'second': true, 'third': false}">...</some-element>
335
+ * ```
336
+ * @description
337
+ *
338
+ * Adds and removes CSS classes on an HTML element.
339
+ *
340
+ * The CSS classes are updated as follows, depending on the type of the expression evaluation:
341
+ * - `string` - the CSS classes listed in the string (space delimited) are added,
342
+ * - `Array` - the CSS classes declared as Array elements are added,
343
+ * - `Object` - keys are CSS classes that get added when the expression given in the value
344
+ * evaluates to a truthy value, otherwise they are removed.
345
+ *
346
+ *
347
+ * @see [Class bindings](/guide/templates/binding#css-class-and-style-property-bindings)
348
+ *
349
+ * @publicApi
350
+ */
351
+ declare class NgClass implements DoCheck {
352
+ private _ngEl;
353
+ private _renderer;
354
+ private initialClasses;
355
+ private rawClass;
356
+ private stateMap;
357
+ constructor(_ngEl: ElementRef, _renderer: Renderer2);
358
+ set klass(value: string);
359
+ set ngClass(value: string | string[] | Set<string> | {
360
+ [klass: string]: any;
361
+ } | null | undefined);
362
+ ngDoCheck(): void;
363
+ private _updateState;
364
+ private _applyStateDiff;
365
+ private _toggleClass;
366
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgClass, never>;
367
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgClass, "[ngClass]", never, { "klass": { "alias": "class"; "required": false; }; "ngClass": { "alias": "ngClass"; "required": false; }; }, {}, never, never, true, never>;
368
+ }
369
+
370
+ /**
371
+ * Instantiates a {@link /api/core/Component Component} type and inserts its Host View into the current View.
372
+ * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
373
+ *
374
+ * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
375
+ * any existing component will be destroyed.
376
+ *
377
+ * @usageNotes
378
+ *
379
+ * ### Fine tune control
380
+ *
381
+ * You can control the component creation process by using the following optional attributes:
382
+ *
383
+ * * `ngComponentOutletInputs`: Optional component inputs object, which will be bind to the
384
+ * component.
385
+ *
386
+ * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for
387
+ * the Component. Defaults to the injector of the current view container.
388
+ *
389
+ * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
390
+ * section of the component, if it exists.
391
+ *
392
+ * * `ngComponentOutletNgModule`: Optional NgModule class reference to allow loading another
393
+ * module dynamically, then loading a component from that module.
394
+ *
395
+ * * `ngComponentOutletNgModuleFactory`: Deprecated config option that allows providing optional
396
+ * NgModule factory to allow loading another module dynamically, then loading a component from that
397
+ * module. Use `ngComponentOutletNgModule` instead.
398
+ *
399
+ * ### Syntax
400
+ *
401
+ * Simple
402
+ * ```html
403
+ * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
404
+ * ```
405
+ *
406
+ * With inputs
407
+ * ```html
408
+ * <ng-container *ngComponentOutlet="componentTypeExpression;
409
+ * inputs: inputsExpression;">
410
+ * </ng-container>
411
+ * ```
412
+ *
413
+ * Customized injector/content
414
+ * ```html
415
+ * <ng-container *ngComponentOutlet="componentTypeExpression;
416
+ * injector: injectorExpression;
417
+ * content: contentNodesExpression;">
418
+ * </ng-container>
419
+ * ```
420
+ *
421
+ * Customized NgModule reference
422
+ * ```html
423
+ * <ng-container *ngComponentOutlet="componentTypeExpression;
424
+ * ngModule: ngModuleClass;">
425
+ * </ng-container>
426
+ * ```
427
+ *
428
+ * ### A simple example
429
+ *
430
+ * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
431
+ *
432
+ * A more complete example with additional options:
433
+ *
434
+ * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
435
+ *
436
+ * @publicApi
437
+ * @ngModule CommonModule
438
+ */
439
+ declare class NgComponentOutlet<T = any> implements OnChanges, DoCheck, OnDestroy {
440
+ private _viewContainerRef;
441
+ /** Component that should be rendered in the outlet. */
442
+ ngComponentOutlet: Type<any> | null;
443
+ ngComponentOutletInputs?: Record<string, unknown>;
444
+ ngComponentOutletInjector?: Injector;
445
+ ngComponentOutletContent?: any[][];
446
+ ngComponentOutletNgModule?: Type<any>;
447
+ /**
448
+ * @deprecated This input is deprecated, use `ngComponentOutletNgModule` instead.
449
+ */
450
+ ngComponentOutletNgModuleFactory?: NgModuleFactory<any>;
451
+ private _componentRef;
452
+ private _moduleRef;
453
+ /**
454
+ * A helper data structure that allows us to track inputs that were part of the
455
+ * ngComponentOutletInputs expression. Tracking inputs is necessary for proper removal of ones
456
+ * that are no longer referenced.
457
+ */
458
+ private _inputsUsed;
459
+ /**
460
+ * Gets the instance of the currently-rendered component.
461
+ * Will be null if no component has been rendered.
462
+ */
463
+ get componentInstance(): T | null;
464
+ constructor(_viewContainerRef: ViewContainerRef);
465
+ private _needToReCreateNgModuleInstance;
466
+ private _needToReCreateComponentInstance;
467
+ /** @nodoc */
468
+ ngOnChanges(changes: SimpleChanges): void;
469
+ /** @nodoc */
470
+ ngDoCheck(): void;
471
+ /** @nodoc */
472
+ ngOnDestroy(): void;
473
+ private _applyInputStateDiff;
474
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgComponentOutlet<any>, never>;
475
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgComponentOutlet<any>, "[ngComponentOutlet]", ["ngComponentOutlet"], { "ngComponentOutlet": { "alias": "ngComponentOutlet"; "required": false; }; "ngComponentOutletInputs": { "alias": "ngComponentOutletInputs"; "required": false; }; "ngComponentOutletInjector": { "alias": "ngComponentOutletInjector"; "required": false; }; "ngComponentOutletContent": { "alias": "ngComponentOutletContent"; "required": false; }; "ngComponentOutletNgModule": { "alias": "ngComponentOutletNgModule"; "required": false; }; "ngComponentOutletNgModuleFactory": { "alias": "ngComponentOutletNgModuleFactory"; "required": false; }; }, {}, never, never, true, never>;
476
+ }
477
+
478
+ /**
479
+ * @publicApi
480
+ */
481
+ declare class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {
482
+ /** Reference to the current item from the collection. */
483
+ $implicit: T;
484
+ /**
485
+ * The value of the iterable expression. Useful when the expression is
486
+ * more complex then a property access, for example when using the async pipe
487
+ * (`userStreams | async`).
488
+ */
489
+ ngForOf: U;
490
+ /** Returns an index of the current item in the collection. */
491
+ index: number;
492
+ /** Returns total amount of items in the collection. */
493
+ count: number;
494
+ constructor(
495
+ /** Reference to the current item from the collection. */
496
+ $implicit: T,
497
+ /**
498
+ * The value of the iterable expression. Useful when the expression is
499
+ * more complex then a property access, for example when using the async pipe
500
+ * (`userStreams | async`).
501
+ */
502
+ ngForOf: U,
503
+ /** Returns an index of the current item in the collection. */
504
+ index: number,
505
+ /** Returns total amount of items in the collection. */
506
+ count: number);
507
+ get first(): boolean;
508
+ get last(): boolean;
509
+ get even(): boolean;
510
+ get odd(): boolean;
511
+ }
512
+ /**
513
+ * A [structural directive](guide/directives/structural-directives) that renders
514
+ * a template for each item in a collection.
515
+ * The directive is placed on an element, which becomes the parent
516
+ * of the cloned templates.
517
+ *
518
+ * The `ngForOf` directive is generally used in the
519
+ * [shorthand form](guide/directives/structural-directives#asterisk) `*ngFor`.
520
+ * In this form, the template to be rendered for each iteration is the content
521
+ * of an anchor element containing the directive.
522
+ *
523
+ * The following example shows the shorthand syntax with some options,
524
+ * contained in an `<li>` element.
525
+ *
526
+ * ```html
527
+ * <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>
528
+ * ```
529
+ *
530
+ * The shorthand form expands into a long form that uses the `ngForOf` selector
531
+ * on an `<ng-template>` element.
532
+ * The content of the `<ng-template>` element is the `<li>` element that held the
533
+ * short-form directive.
534
+ *
535
+ * Here is the expanded version of the short-form example.
536
+ *
537
+ * ```html
538
+ * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
539
+ * <li>...</li>
540
+ * </ng-template>
541
+ * ```
542
+ *
543
+ * Angular automatically expands the shorthand syntax as it compiles the template.
544
+ * The context for each embedded view is logically merged to the current component
545
+ * context according to its lexical position.
546
+ *
547
+ * When using the shorthand syntax, Angular allows only [one structural directive
548
+ * on an element](guide/directives/structural-directives#one-per-element).
549
+ * If you want to iterate conditionally, for example,
550
+ * put the `*ngIf` on a container element that wraps the `*ngFor` element.
551
+ * For further discussion, see
552
+ * [Structural Directives](guide/directives/structural-directives#one-per-element).
553
+ *
554
+ * @usageNotes
555
+ *
556
+ * ### Local variables
557
+ *
558
+ * `NgForOf` provides exported values that can be aliased to local variables.
559
+ * For example:
560
+ *
561
+ * ```html
562
+ * <li *ngFor="let user of users; index as i; first as isFirst">
563
+ * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
564
+ * </li>
565
+ * ```
566
+ *
567
+ * The following exported values can be aliased to local variables:
568
+ *
569
+ * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
570
+ * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
571
+ * more complex then a property access, for example when using the async pipe (`userStreams |
572
+ * async`).
573
+ * - `index: number`: The index of the current item in the iterable.
574
+ * - `count: number`: The length of the iterable.
575
+ * - `first: boolean`: True when the item is the first item in the iterable.
576
+ * - `last: boolean`: True when the item is the last item in the iterable.
577
+ * - `even: boolean`: True when the item has an even index in the iterable.
578
+ * - `odd: boolean`: True when the item has an odd index in the iterable.
579
+ *
580
+ * ### Change propagation
581
+ *
582
+ * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
583
+ *
584
+ * * When an item is added, a new instance of the template is added to the DOM.
585
+ * * When an item is removed, its template instance is removed from the DOM.
586
+ * * When items are reordered, their respective templates are reordered in the DOM.
587
+ *
588
+ * Angular uses object identity to track insertions and deletions within the iterator and reproduce
589
+ * those changes in the DOM. This has important implications for animations and any stateful
590
+ * controls that are present, such as `<input>` elements that accept user input. Inserted rows can
591
+ * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
592
+ * such as user input.
593
+ * For more on animations, see [Transitions and Triggers](guide/animations/transition-and-triggers).
594
+ *
595
+ * The identities of elements in the iterator can change while the data does not.
596
+ * This can happen, for example, if the iterator is produced from an RPC to the server, and that
597
+ * RPC is re-run. Even if the data hasn't changed, the second response produces objects with
598
+ * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old
599
+ * elements were deleted and all new elements inserted).
600
+ *
601
+ * To avoid this expensive operation, you can customize the default tracking algorithm.
602
+ * by supplying the `trackBy` option to `NgForOf`.
603
+ * `trackBy` takes a function that has two arguments: `index` and `item`.
604
+ * If `trackBy` is given, Angular tracks changes by the return value of the function.
605
+ *
606
+ * @see [Structural Directives](guide/directives/structural-directives)
607
+ * @ngModule CommonModule
608
+ * @publicApi
609
+ */
610
+ declare class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCheck {
611
+ private _viewContainer;
612
+ private _template;
613
+ private _differs;
614
+ /**
615
+ * The value of the iterable expression, which can be used as a
616
+ * [template input variable](guide/directives/structural-directives#shorthand).
617
+ */
618
+ set ngForOf(ngForOf: (U & NgIterable<T>) | undefined | null);
619
+ /**
620
+ * Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.
621
+ *
622
+ * If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object
623
+ * identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
624
+ * as the key.
625
+ *
626
+ * `NgForOf` uses the computed key to associate items in an iterable with DOM elements
627
+ * it produces for these items.
628
+ *
629
+ * A custom `TrackByFunction` is useful to provide good user experience in cases when items in an
630
+ * iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a
631
+ * primary key), and this iterable could be updated with new object instances that still
632
+ * represent the same underlying entity (for example, when data is re-fetched from the server,
633
+ * and the iterable is recreated and re-rendered, but most of the data is still the same).
634
+ *
635
+ * @see {@link TrackByFunction}
636
+ */
637
+ set ngForTrackBy(fn: TrackByFunction<T>);
638
+ get ngForTrackBy(): TrackByFunction<T>;
639
+ private _ngForOf;
640
+ private _ngForOfDirty;
641
+ private _differ;
642
+ private _trackByFn;
643
+ constructor(_viewContainer: ViewContainerRef, _template: TemplateRef<NgForOfContext<T, U>>, _differs: IterableDiffers);
644
+ /**
645
+ * A reference to the template that is stamped out for each item in the iterable.
646
+ * @see [template reference variable](guide/templates/variables#template-reference-variables)
647
+ */
648
+ set ngForTemplate(value: TemplateRef<NgForOfContext<T, U>>);
649
+ /**
650
+ * Applies the changes when needed.
651
+ * @nodoc
652
+ */
653
+ ngDoCheck(): void;
654
+ private _applyChanges;
655
+ /**
656
+ * Asserts the correct type of the context for the template that `NgForOf` will render.
657
+ *
658
+ * The presence of this method is a signal to the Ivy template type-check compiler that the
659
+ * `NgForOf` structural directive renders its template with a specific context type.
660
+ */
661
+ static ngTemplateContextGuard<T, U extends NgIterable<T>>(dir: NgForOf<T, U>, ctx: any): ctx is NgForOfContext<T, U>;
662
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgForOf<any, any>, never>;
663
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgForOf<any, any>, "[ngFor][ngForOf]", never, { "ngForOf": { "alias": "ngForOf"; "required": false; }; "ngForTrackBy": { "alias": "ngForTrackBy"; "required": false; }; "ngForTemplate": { "alias": "ngForTemplate"; "required": false; }; }, {}, never, never, true, never>;
664
+ }
665
+
666
+ /**
667
+ * A structural directive that conditionally includes a template based on the value of
668
+ * an expression coerced to Boolean.
669
+ * When the expression evaluates to true, Angular renders the template
670
+ * provided in a `then` clause, and when false or null,
671
+ * Angular renders the template provided in an optional `else` clause. The default
672
+ * template for the `else` clause is blank.
673
+ *
674
+ * A [shorthand form](guide/directives/structural-directives#asterisk) of the directive,
675
+ * `*ngIf="condition"`, is generally used, provided
676
+ * as an attribute of the anchor element for the inserted template.
677
+ * Angular expands this into a more explicit version, in which the anchor element
678
+ * is contained in an `<ng-template>` element.
679
+ *
680
+ * Simple form with shorthand syntax:
681
+ *
682
+ * ```html
683
+ * <div *ngIf="condition">Content to render when condition is true.</div>
684
+ * ```
685
+ *
686
+ * Simple form with expanded syntax:
687
+ *
688
+ * ```html
689
+ * <ng-template [ngIf]="condition"><div>Content to render when condition is
690
+ * true.</div></ng-template>
691
+ * ```
692
+ *
693
+ * Form with an "else" block:
694
+ *
695
+ * ```html
696
+ * <div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
697
+ * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
698
+ * ```
699
+ *
700
+ * Shorthand form with "then" and "else" blocks:
701
+ *
702
+ * ```html
703
+ * <div *ngIf="condition; then thenBlock else elseBlock"></div>
704
+ * <ng-template #thenBlock>Content to render when condition is true.</ng-template>
705
+ * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
706
+ * ```
707
+ *
708
+ * Form with storing the value locally:
709
+ *
710
+ * ```html
711
+ * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
712
+ * <ng-template #elseBlock>Content to render when value is null.</ng-template>
713
+ * ```
714
+ *
715
+ * @usageNotes
716
+ *
717
+ * The `*ngIf` directive is most commonly used to conditionally show an inline template,
718
+ * as seen in the following example.
719
+ * The default `else` template is blank.
720
+ *
721
+ * {@example common/ngIf/ts/module.ts region='NgIfSimple'}
722
+ *
723
+ * ### Showing an alternative template using `else`
724
+ *
725
+ * To display a template when `expression` evaluates to false, use an `else` template
726
+ * binding as shown in the following example.
727
+ * The `else` binding points to an `<ng-template>` element labeled `#elseBlock`.
728
+ * The template can be defined anywhere in the component view, but is typically placed right after
729
+ * `ngIf` for readability.
730
+ *
731
+ * {@example common/ngIf/ts/module.ts region='NgIfElse'}
732
+ *
733
+ * ### Using an external `then` template
734
+ *
735
+ * In the previous example, the then-clause template is specified inline, as the content of the
736
+ * tag that contains the `ngIf` directive. You can also specify a template that is defined
737
+ * externally, by referencing a labeled `<ng-template>` element. When you do this, you can
738
+ * change which template to use at runtime, as shown in the following example.
739
+ *
740
+ * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
741
+ *
742
+ * ### Storing a conditional result in a variable
743
+ *
744
+ * You might want to show a set of properties from the same object. If you are waiting
745
+ * for asynchronous data, the object can be undefined.
746
+ * In this case, you can use `ngIf` and store the result of the condition in a local
747
+ * variable as shown in the following example.
748
+ *
749
+ * {@example common/ngIf/ts/module.ts region='NgIfAs'}
750
+ *
751
+ * This code uses only one `AsyncPipe`, so only one subscription is created.
752
+ * The conditional statement stores the result of `userStream|async` in the local variable `user`.
753
+ * You can then bind the local `user` repeatedly.
754
+ *
755
+ * The conditional displays the data only if `userStream` returns a value,
756
+ * so you don't need to use the
757
+ * safe-navigation-operator (`?.`)
758
+ * to guard against null values when accessing properties.
759
+ * You can display an alternative template while waiting for the data.
760
+ *
761
+ * ### Shorthand syntax
762
+ *
763
+ * The shorthand syntax `*ngIf` expands into two separate template specifications
764
+ * for the "then" and "else" clauses. For example, consider the following shorthand statement,
765
+ * that is meant to show a loading page while waiting for data to be loaded.
766
+ *
767
+ * ```html
768
+ * <div class="hero-list" *ngIf="heroes else loading">
769
+ * ...
770
+ * </div>
771
+ *
772
+ * <ng-template #loading>
773
+ * <div>Loading...</div>
774
+ * </ng-template>
775
+ * ```
776
+ *
777
+ * You can see that the "else" clause references the `<ng-template>`
778
+ * with the `#loading` label, and the template for the "then" clause
779
+ * is provided as the content of the anchor element.
780
+ *
781
+ * However, when Angular expands the shorthand syntax, it creates
782
+ * another `<ng-template>` tag, with `ngIf` and `ngIfElse` directives.
783
+ * The anchor element containing the template for the "then" clause becomes
784
+ * the content of this unlabeled `<ng-template>` tag.
785
+ *
786
+ * ```html
787
+ * <ng-template [ngIf]="heroes" [ngIfElse]="loading">
788
+ * <div class="hero-list">
789
+ * ...
790
+ * </div>
791
+ * </ng-template>
792
+ *
793
+ * <ng-template #loading>
794
+ * <div>Loading...</div>
795
+ * </ng-template>
796
+ * ```
797
+ *
798
+ * The presence of the implicit template object has implications for the nesting of
799
+ * structural directives. For more on this subject, see
800
+ * [Structural Directives](guide/directives/structural-directives#one-per-element).
801
+ *
802
+ * @ngModule CommonModule
803
+ * @publicApi
804
+ */
805
+ declare class NgIf<T = unknown> {
806
+ private _viewContainer;
807
+ private _context;
808
+ private _thenTemplateRef;
809
+ private _elseTemplateRef;
810
+ private _thenViewRef;
811
+ private _elseViewRef;
812
+ constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext<T>>);
813
+ /**
814
+ * The Boolean expression to evaluate as the condition for showing a template.
815
+ */
816
+ set ngIf(condition: T);
817
+ /**
818
+ * A template to show if the condition expression evaluates to true.
819
+ */
820
+ set ngIfThen(templateRef: TemplateRef<NgIfContext<T>> | null);
821
+ /**
822
+ * A template to show if the condition expression evaluates to false.
823
+ */
824
+ set ngIfElse(templateRef: TemplateRef<NgIfContext<T>> | null);
825
+ private _updateView;
826
+ /**
827
+ * Assert the correct type of the expression bound to the `ngIf` input within the template.
828
+ *
829
+ * The presence of this static field is a signal to the Ivy template type check compiler that
830
+ * when the `NgIf` structural directive renders its template, the type of the expression bound
831
+ * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
832
+ * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
833
+ */
834
+ static ngTemplateGuard_ngIf: 'binding';
835
+ /**
836
+ * Asserts the correct type of the context for the template that `NgIf` will render.
837
+ *
838
+ * The presence of this method is a signal to the Ivy template type-check compiler that the
839
+ * `NgIf` structural directive renders its template with a specific context type.
840
+ */
841
+ static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): ctx is NgIfContext<Exclude<T, false | 0 | '' | null | undefined>>;
842
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgIf<any>, never>;
843
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgIf<any>, "[ngIf]", never, { "ngIf": { "alias": "ngIf"; "required": false; }; "ngIfThen": { "alias": "ngIfThen"; "required": false; }; "ngIfElse": { "alias": "ngIfElse"; "required": false; }; }, {}, never, never, true, never>;
844
+ }
845
+ /**
846
+ * @publicApi
847
+ */
848
+ declare class NgIfContext<T = unknown> {
849
+ $implicit: T;
850
+ ngIf: T;
851
+ }
852
+
853
+ /**
854
+ * @ngModule CommonModule
855
+ *
856
+ * @description
857
+ *
858
+ * Inserts an embedded view from a prepared `TemplateRef`.
859
+ *
860
+ * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
861
+ * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
862
+ * by the local template `let` declarations.
863
+ *
864
+ * @usageNotes
865
+ * ```html
866
+ * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
867
+ * ```
868
+ *
869
+ * Using the key `$implicit` in the context object will set its value as default.
870
+ *
871
+ * ### Example
872
+ *
873
+ * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
874
+ *
875
+ * @publicApi
876
+ */
877
+ declare class NgTemplateOutlet<C = unknown> implements OnChanges {
878
+ private _viewContainerRef;
879
+ private _viewRef;
880
+ /**
881
+ * A context object to attach to the {@link EmbeddedViewRef}. This should be an
882
+ * object, the object's keys will be available for binding by the local template `let`
883
+ * declarations.
884
+ * Using the key `$implicit` in the context object will set its value as default.
885
+ */
886
+ ngTemplateOutletContext: C | null;
887
+ /**
888
+ * A string defining the template reference and optionally the context object for the template.
889
+ */
890
+ ngTemplateOutlet: TemplateRef<C> | null;
891
+ /** Injector to be used within the embedded view. */
892
+ ngTemplateOutletInjector: Injector | null;
893
+ constructor(_viewContainerRef: ViewContainerRef);
894
+ ngOnChanges(changes: SimpleChanges): void;
895
+ /**
896
+ * We need to re-create existing embedded view if either is true:
897
+ * - the outlet changed.
898
+ * - the injector changed.
899
+ */
900
+ private _shouldRecreateView;
901
+ /**
902
+ * For a given outlet instance, we create a proxy object that delegates
903
+ * to the user-specified context. This allows changing, or swapping out
904
+ * the context object completely without having to destroy/re-create the view.
905
+ */
906
+ private _createContextForwardProxy;
907
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgTemplateOutlet<any>, never>;
908
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgTemplateOutlet<any>, "[ngTemplateOutlet]", never, { "ngTemplateOutletContext": { "alias": "ngTemplateOutletContext"; "required": false; }; "ngTemplateOutlet": { "alias": "ngTemplateOutlet"; "required": false; }; "ngTemplateOutletInjector": { "alias": "ngTemplateOutletInjector"; "required": false; }; }, {}, never, never, true, never>;
909
+ }
910
+
911
+ /**
912
+ * @ngModule CommonModule
913
+ *
914
+ * @usageNotes
915
+ *
916
+ * Set the width of the containing element to a pixel value returned by an expression.
917
+ *
918
+ * ```html
919
+ * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
920
+ * ```
921
+ *
922
+ * Set a collection of style values using an expression that returns key-value pairs.
923
+ *
924
+ * ```html
925
+ * <some-element [ngStyle]="objExp">...</some-element>
926
+ * ```
927
+ *
928
+ * For more simple use cases you can use the [style bindings](/guide/templates/binding#css-class-and-style-property-bindings) directly.
929
+ * It doesn't require importing a directive.
930
+ *
931
+ * Set the font of the containing element to the result of an expression.
932
+ *
933
+ * ```html
934
+ * <some-element [style]="{'font-style': styleExp}">...</some-element>
935
+ * ```
936
+ *
937
+ * @description
938
+ *
939
+ * An attribute directive that updates styles for the containing HTML element.
940
+ * Sets one or more style properties, specified as colon-separated key-value pairs.
941
+ * The key is a style name, with an optional `.<unit>` suffix
942
+ * (such as 'top.px', 'font-style.em').
943
+ * The value is an expression to be evaluated.
944
+ * The resulting non-null value, expressed in the given unit,
945
+ * is assigned to the given style property.
946
+ * If the result of evaluation is null, the corresponding style is removed.
947
+ *
948
+ * @see [Style bindings](/guide/templates/binding#css-class-and-style-property-bindings)
949
+ *
950
+ * @publicApi
951
+ */
952
+ declare class NgStyle implements DoCheck {
953
+ private _ngEl;
954
+ private _differs;
955
+ private _renderer;
956
+ private _ngStyle;
957
+ private _differ;
958
+ constructor(_ngEl: ElementRef, _differs: KeyValueDiffers, _renderer: Renderer2);
959
+ set ngStyle(values: {
960
+ [klass: string]: any;
961
+ } | null | undefined);
962
+ ngDoCheck(): void;
963
+ private _setStyle;
964
+ private _applyChanges;
965
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgStyle, never>;
966
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgStyle, "[ngStyle]", never, { "ngStyle": { "alias": "ngStyle"; "required": false; }; }, {}, never, never, true, never>;
967
+ }
968
+
969
+ declare class SwitchView {
970
+ private _viewContainerRef;
971
+ private _templateRef;
972
+ private _created;
973
+ constructor(_viewContainerRef: ViewContainerRef, _templateRef: TemplateRef<Object>);
974
+ create(): void;
975
+ destroy(): void;
976
+ enforceState(created: boolean): void;
977
+ }
978
+ /**
979
+ * @ngModule CommonModule
980
+ *
981
+ * @description
982
+ * The `[ngSwitch]` directive on a container specifies an expression to match against.
983
+ * The expressions to match are provided by `ngSwitchCase` directives on views within the container.
984
+ * - Every view that matches is rendered.
985
+ * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered.
986
+ * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase`
987
+ * or `ngSwitchDefault` directive are preserved at the location.
988
+ *
989
+ * @usageNotes
990
+ * Define a container element for the directive, and specify the switch expression
991
+ * to match against as an attribute:
992
+ *
993
+ * ```html
994
+ * <container-element [ngSwitch]="switch_expression">
995
+ * ```
996
+ *
997
+ * Within the container, `*ngSwitchCase` statements specify the match expressions
998
+ * as attributes. Include `*ngSwitchDefault` as the final case.
999
+ *
1000
+ * ```html
1001
+ * <container-element [ngSwitch]="switch_expression">
1002
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1003
+ * ...
1004
+ * <some-element *ngSwitchDefault>...</some-element>
1005
+ * </container-element>
1006
+ * ```
1007
+ *
1008
+ * ### Usage Examples
1009
+ *
1010
+ * The following example shows how to use more than one case to display the same view:
1011
+ *
1012
+ * ```html
1013
+ * <container-element [ngSwitch]="switch_expression">
1014
+ * <!-- the same view can be shown in more than one case -->
1015
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1016
+ * <some-element *ngSwitchCase="match_expression_2">...</some-element>
1017
+ * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
1018
+ * <!--default case when there are no matches -->
1019
+ * <some-element *ngSwitchDefault>...</some-element>
1020
+ * </container-element>
1021
+ * ```
1022
+ *
1023
+ * The following example shows how cases can be nested:
1024
+ * ```html
1025
+ * <container-element [ngSwitch]="switch_expression">
1026
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1027
+ * <some-element *ngSwitchCase="match_expression_2">...</some-element>
1028
+ * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
1029
+ * <ng-container *ngSwitchCase="match_expression_3">
1030
+ * <!-- use a ng-container to group multiple root nodes -->
1031
+ * <inner-element></inner-element>
1032
+ * <inner-other-element></inner-other-element>
1033
+ * </ng-container>
1034
+ * <some-element *ngSwitchDefault>...</some-element>
1035
+ * </container-element>
1036
+ * ```
1037
+ *
1038
+ * @publicApi
1039
+ * @see {@link NgSwitchCase}
1040
+ * @see {@link NgSwitchDefault}
1041
+ * @see [Structural Directives](guide/directives/structural-directives)
1042
+ *
1043
+ */
1044
+ declare class NgSwitch {
1045
+ private _defaultViews;
1046
+ private _defaultUsed;
1047
+ private _caseCount;
1048
+ private _lastCaseCheckIndex;
1049
+ private _lastCasesMatched;
1050
+ private _ngSwitch;
1051
+ set ngSwitch(newValue: any);
1052
+ private _updateDefaultCases;
1053
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitch, never>;
1054
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitch, "[ngSwitch]", never, { "ngSwitch": { "alias": "ngSwitch"; "required": false; }; }, {}, never, never, true, never>;
1055
+ }
1056
+ /**
1057
+ * @ngModule CommonModule
1058
+ *
1059
+ * @description
1060
+ * Provides a switch case expression to match against an enclosing `ngSwitch` expression.
1061
+ * When the expressions match, the given `NgSwitchCase` template is rendered.
1062
+ * If multiple match expressions match the switch expression value, all of them are displayed.
1063
+ *
1064
+ * @usageNotes
1065
+ *
1066
+ * Within a switch container, `*ngSwitchCase` statements specify the match expressions
1067
+ * as attributes. Include `*ngSwitchDefault` as the final case.
1068
+ *
1069
+ * ```html
1070
+ * <container-element [ngSwitch]="switch_expression">
1071
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1072
+ * ...
1073
+ * <some-element *ngSwitchDefault>...</some-element>
1074
+ * </container-element>
1075
+ * ```
1076
+ *
1077
+ * Each switch-case statement contains an in-line HTML template or template reference
1078
+ * that defines the subtree to be selected if the value of the match expression
1079
+ * matches the value of the switch expression.
1080
+ *
1081
+ * As of Angular v17 the NgSwitch directive uses strict equality comparison (`===`) instead of
1082
+ * loose equality (`==`) to match different cases.
1083
+ *
1084
+ * @publicApi
1085
+ * @see {@link NgSwitch}
1086
+ * @see {@link NgSwitchDefault}
1087
+ *
1088
+ */
1089
+ declare class NgSwitchCase implements DoCheck {
1090
+ private ngSwitch;
1091
+ private _view;
1092
+ /**
1093
+ * Stores the HTML template to be selected on match.
1094
+ */
1095
+ ngSwitchCase: any;
1096
+ constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
1097
+ /**
1098
+ * Performs case matching. For internal use only.
1099
+ * @nodoc
1100
+ */
1101
+ ngDoCheck(): void;
1102
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchCase, [null, null, { optional: true; host: true; }]>;
1103
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchCase, "[ngSwitchCase]", never, { "ngSwitchCase": { "alias": "ngSwitchCase"; "required": false; }; }, {}, never, never, true, never>;
1104
+ }
1105
+ /**
1106
+ * @ngModule CommonModule
1107
+ *
1108
+ * @description
1109
+ *
1110
+ * Creates a view that is rendered when no `NgSwitchCase` expressions
1111
+ * match the `NgSwitch` expression.
1112
+ * This statement should be the final case in an `NgSwitch`.
1113
+ *
1114
+ * @publicApi
1115
+ * @see {@link NgSwitch}
1116
+ * @see {@link NgSwitchCase}
1117
+ *
1118
+ */
1119
+ declare class NgSwitchDefault {
1120
+ constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
1121
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchDefault, [null, null, { optional: true; host: true; }]>;
1122
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchDefault, "[ngSwitchDefault]", never, {}, {}, never, never, true, never>;
1123
+ }
1124
+
1125
+ /**
1126
+ * @ngModule CommonModule
1127
+ *
1128
+ * @usageNotes
1129
+ * ```html
1130
+ * <some-element [ngPlural]="value">
1131
+ * <ng-template ngPluralCase="=0">there is nothing</ng-template>
1132
+ * <ng-template ngPluralCase="=1">there is one</ng-template>
1133
+ * <ng-template ngPluralCase="few">there are a few</ng-template>
1134
+ * </some-element>
1135
+ * ```
1136
+ *
1137
+ * @description
1138
+ *
1139
+ * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
1140
+ *
1141
+ * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
1142
+ * that match the switch expression's pluralization category.
1143
+ *
1144
+ * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
1145
+ * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
1146
+ * expression:
1147
+ * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
1148
+ * matches the switch expression exactly,
1149
+ * - otherwise, the view will be treated as a "category match", and will only display if exact
1150
+ * value matches aren't found and the value maps to its category for the defined locale.
1151
+ *
1152
+ * See http://cldr.unicode.org/index/cldr-spec/plural-rules
1153
+ *
1154
+ * @publicApi
1155
+ */
1156
+ declare class NgPlural {
1157
+ private _localization;
1158
+ private _activeView?;
1159
+ private _caseViews;
1160
+ constructor(_localization: NgLocalization);
1161
+ set ngPlural(value: number);
1162
+ addCase(value: string, switchView: SwitchView): void;
1163
+ private _updateView;
1164
+ private _clearViews;
1165
+ private _activateView;
1166
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgPlural, never>;
1167
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgPlural, "[ngPlural]", never, { "ngPlural": { "alias": "ngPlural"; "required": false; }; }, {}, never, never, true, never>;
1168
+ }
1169
+ /**
1170
+ * @ngModule CommonModule
1171
+ *
1172
+ * @description
1173
+ *
1174
+ * Creates a view that will be added/removed from the parent {@link NgPlural} when the
1175
+ * given expression matches the plural expression according to CLDR rules.
1176
+ *
1177
+ * @usageNotes
1178
+ * ```html
1179
+ * <some-element [ngPlural]="value">
1180
+ * <ng-template ngPluralCase="=0">...</ng-template>
1181
+ * <ng-template ngPluralCase="other">...</ng-template>
1182
+ * </some-element>
1183
+ *```
1184
+ *
1185
+ * See {@link NgPlural} for more details and example.
1186
+ *
1187
+ * @publicApi
1188
+ */
1189
+ declare class NgPluralCase {
1190
+ value: string;
1191
+ constructor(value: string, template: TemplateRef<Object>, viewContainer: ViewContainerRef, ngPlural: NgPlural);
1192
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgPluralCase, [{ attribute: "ngPluralCase"; }, null, null, { host: true; }]>;
1193
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgPluralCase, "[ngPluralCase]", never, {}, {}, never, never, true, never>;
1194
+ }
1195
+
1196
+ /**
1197
+ * @ngModule CommonModule
1198
+ * @description
1199
+ *
1200
+ * Unwraps a value from an asynchronous primitive.
1201
+ *
1202
+ * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
1203
+ * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
1204
+ * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
1205
+ * potential memory leaks. When the reference of the expression changes, the `async` pipe
1206
+ * automatically unsubscribes from the old `Observable` or `Promise` and subscribes to the new one.
1207
+ *
1208
+ * @usageNotes
1209
+ *
1210
+ * ### Examples
1211
+ *
1212
+ * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
1213
+ * promise.
1214
+ *
1215
+ * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
1216
+ *
1217
+ * It's also possible to use `async` with Observables. The example below binds the `time` Observable
1218
+ * to the view. The Observable continuously updates the view with the current time.
1219
+ *
1220
+ * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
1221
+ *
1222
+ * @publicApi
1223
+ */
1224
+ declare class AsyncPipe implements OnDestroy, PipeTransform {
1225
+ private _ref;
1226
+ private _latestValue;
1227
+ private markForCheckOnValueUpdate;
1228
+ private _subscription;
1229
+ private _obj;
1230
+ private _strategy;
1231
+ constructor(ref: ChangeDetectorRef);
1232
+ ngOnDestroy(): void;
1233
+ transform<T>(obj: Observable<T> | Subscribable<T> | Promise<T>): T | null;
1234
+ transform<T>(obj: null | undefined): null;
1235
+ transform<T>(obj: Observable<T> | Subscribable<T> | Promise<T> | null | undefined): T | null;
1236
+ private _subscribe;
1237
+ private _selectStrategy;
1238
+ private _dispose;
1239
+ private _updateLatestValue;
1240
+ static ɵfac: i0.ɵɵFactoryDeclaration<AsyncPipe, never>;
1241
+ static ɵpipe: i0.ɵɵPipeDeclaration<AsyncPipe, "async", true>;
1242
+ }
1243
+
1244
+ /**
1245
+ * Transforms text to all lower case.
1246
+ *
1247
+ * @see {@link UpperCasePipe}
1248
+ * @see {@link TitleCasePipe}
1249
+ * @usageNotes
1250
+ *
1251
+ * The following example defines a view that allows the user to enter
1252
+ * text, and then uses the pipe to convert the input text to all lower case.
1253
+ *
1254
+ * {@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe'}
1255
+ *
1256
+ * @ngModule CommonModule
1257
+ * @publicApi
1258
+ */
1259
+ declare class LowerCasePipe implements PipeTransform {
1260
+ /**
1261
+ * @param value The string to transform to lower case.
1262
+ */
1263
+ transform(value: string): string;
1264
+ transform(value: null | undefined): null;
1265
+ transform(value: string | null | undefined): string | null;
1266
+ static ɵfac: i0.ɵɵFactoryDeclaration<LowerCasePipe, never>;
1267
+ static ɵpipe: i0.ɵɵPipeDeclaration<LowerCasePipe, "lowercase", true>;
1268
+ }
1269
+ /**
1270
+ * Transforms text to title case.
1271
+ * Capitalizes the first letter of each word and transforms the
1272
+ * rest of the word to lower case.
1273
+ * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.
1274
+ *
1275
+ * @see {@link LowerCasePipe}
1276
+ * @see {@link UpperCasePipe}
1277
+ *
1278
+ * @usageNotes
1279
+ * The following example shows the result of transforming various strings into title case.
1280
+ *
1281
+ * {@example common/pipes/ts/titlecase_pipe.ts region='TitleCasePipe'}
1282
+ *
1283
+ * @ngModule CommonModule
1284
+ * @publicApi
1285
+ */
1286
+ declare class TitleCasePipe implements PipeTransform {
1287
+ /**
1288
+ * @param value The string to transform to title case.
1289
+ */
1290
+ transform(value: string): string;
1291
+ transform(value: null | undefined): null;
1292
+ transform(value: string | null | undefined): string | null;
1293
+ static ɵfac: i0.ɵɵFactoryDeclaration<TitleCasePipe, never>;
1294
+ static ɵpipe: i0.ɵɵPipeDeclaration<TitleCasePipe, "titlecase", true>;
1295
+ }
1296
+ /**
1297
+ * Transforms text to all upper case.
1298
+ * @see {@link LowerCasePipe}
1299
+ * @see {@link TitleCasePipe}
1300
+ *
1301
+ * @ngModule CommonModule
1302
+ * @publicApi
1303
+ */
1304
+ declare class UpperCasePipe implements PipeTransform {
1305
+ /**
1306
+ * @param value The string to transform to upper case.
1307
+ */
1308
+ transform(value: string): string;
1309
+ transform(value: null | undefined): null;
1310
+ transform(value: string | null | undefined): string | null;
1311
+ static ɵfac: i0.ɵɵFactoryDeclaration<UpperCasePipe, never>;
1312
+ static ɵpipe: i0.ɵɵPipeDeclaration<UpperCasePipe, "uppercase", true>;
1313
+ }
1314
+
1315
+ /**
1316
+ * @ngModule CommonModule
1317
+ * @description
1318
+ *
1319
+ * Converts a value into its JSON-format representation. Useful for debugging.
1320
+ *
1321
+ * @usageNotes
1322
+ *
1323
+ * The following component uses a JSON pipe to convert an object
1324
+ * to JSON format, and displays the string in both formats for comparison.
1325
+ *
1326
+ * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
1327
+ *
1328
+ * @publicApi
1329
+ */
1330
+ declare class JsonPipe implements PipeTransform {
1331
+ /**
1332
+ * @param value A value of any type to convert into a JSON-format string.
1333
+ */
1334
+ transform(value: any): string;
1335
+ static ɵfac: i0.ɵɵFactoryDeclaration<JsonPipe, never>;
1336
+ static ɵpipe: i0.ɵɵPipeDeclaration<JsonPipe, "json", true>;
1337
+ }
1338
+
1339
+ /**
1340
+ * @ngModule CommonModule
1341
+ * @description
1342
+ *
1343
+ * Creates a new `Array` or `String` containing a subset (slice) of the elements.
1344
+ *
1345
+ * @usageNotes
1346
+ *
1347
+ * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
1348
+ * and `String.prototype.slice()`.
1349
+ *
1350
+ * When operating on an `Array`, the returned `Array` is always a copy even when all
1351
+ * the elements are being returned.
1352
+ *
1353
+ * When operating on a blank value, the pipe returns the blank value.
1354
+ *
1355
+ * ### List Example
1356
+ *
1357
+ * This `ngFor` example:
1358
+ *
1359
+ * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
1360
+ *
1361
+ * produces the following:
1362
+ *
1363
+ * ```html
1364
+ * <li>b</li>
1365
+ * <li>c</li>
1366
+ * ```
1367
+ *
1368
+ * ### String Examples
1369
+ *
1370
+ * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
1371
+ *
1372
+ * @publicApi
1373
+ */
1374
+ declare class SlicePipe implements PipeTransform {
1375
+ /**
1376
+ * @param value a list or a string to be sliced.
1377
+ * @param start the starting index of the subset to return:
1378
+ * - **a positive integer**: return the item at `start` index and all items after
1379
+ * in the list or string expression.
1380
+ * - **a negative integer**: return the item at `start` index from the end and all items after
1381
+ * in the list or string expression.
1382
+ * - **if positive and greater than the size of the expression**: return an empty list or
1383
+ * string.
1384
+ * - **if negative and greater than the size of the expression**: return entire list or string.
1385
+ * @param end the ending index of the subset to return:
1386
+ * - **omitted**: return all items until the end.
1387
+ * - **if positive**: return all items before `end` index of the list or string.
1388
+ * - **if negative**: return all items before `end` index from the end of the list or string.
1389
+ */
1390
+ transform<T>(value: ReadonlyArray<T>, start: number, end?: number): Array<T>;
1391
+ transform(value: null | undefined, start: number, end?: number): null;
1392
+ transform<T>(value: ReadonlyArray<T> | null | undefined, start: number, end?: number): Array<T> | null;
1393
+ transform(value: string, start: number, end?: number): string;
1394
+ transform(value: string | null | undefined, start: number, end?: number): string | null;
1395
+ static ɵfac: i0.ɵɵFactoryDeclaration<SlicePipe, never>;
1396
+ static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "slice", true>;
1397
+ }
1398
+
1399
+ /**
1400
+ * @ngModule CommonModule
1401
+ * @description
1402
+ *
1403
+ * Formats a value according to digit options and locale rules.
1404
+ * Locale determines group sizing and separator,
1405
+ * decimal point character, and other locale-specific configurations.
1406
+ *
1407
+ * @see {@link formatNumber}
1408
+ *
1409
+ * @usageNotes
1410
+ *
1411
+ * ### digitsInfo
1412
+ *
1413
+ * The value's decimal representation is specified by the `digitsInfo`
1414
+ * parameter, written in the following format:<br>
1415
+ *
1416
+ * ```
1417
+ * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
1418
+ * ```
1419
+ *
1420
+ * - `minIntegerDigits`:
1421
+ * The minimum number of integer digits before the decimal point.
1422
+ * Default is 1.
1423
+ *
1424
+ * - `minFractionDigits`:
1425
+ * The minimum number of digits after the decimal point.
1426
+ * Default is 0.
1427
+ *
1428
+ * - `maxFractionDigits`:
1429
+ * The maximum number of digits after the decimal point.
1430
+ * Default is 3.
1431
+ *
1432
+ * If the formatted value is truncated it will be rounded using the "to-nearest" method:
1433
+ *
1434
+ * ```
1435
+ * {{3.6 | number: '1.0-0'}}
1436
+ * <!--will output '4'-->
1437
+ *
1438
+ * {{-3.6 | number:'1.0-0'}}
1439
+ * <!--will output '-4'-->
1440
+ * ```
1441
+ *
1442
+ * ### locale
1443
+ *
1444
+ * `locale` will format a value according to locale rules.
1445
+ * Locale determines group sizing and separator,
1446
+ * decimal point character, and other locale-specific configurations.
1447
+ *
1448
+ * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
1449
+ *
1450
+ * See [Setting your app locale](guide/i18n/locale-id).
1451
+ *
1452
+ * ### Example
1453
+ *
1454
+ * The following code shows how the pipe transforms values
1455
+ * according to various format specifications,
1456
+ * where the caller's default locale is `en-US`.
1457
+ *
1458
+ * {@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
1459
+ *
1460
+ * @publicApi
1461
+ */
1462
+ declare class DecimalPipe implements PipeTransform {
1463
+ private _locale;
1464
+ constructor(_locale: string);
1465
+ /**
1466
+ * @param value The value to be formatted.
1467
+ * @param digitsInfo Sets digit and decimal representation.
1468
+ * [See more](#digitsinfo).
1469
+ * @param locale Specifies what locale format rules to use.
1470
+ * [See more](#locale).
1471
+ */
1472
+ transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
1473
+ transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
1474
+ transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
1475
+ static ɵfac: i0.ɵɵFactoryDeclaration<DecimalPipe, never>;
1476
+ static ɵpipe: i0.ɵɵPipeDeclaration<DecimalPipe, "number", true>;
1477
+ }
1478
+ /**
1479
+ * @ngModule CommonModule
1480
+ * @description
1481
+ *
1482
+ * Transforms a number to a percentage
1483
+ * string, formatted according to locale rules that determine group sizing and
1484
+ * separator, decimal-point character, and other locale-specific
1485
+ * configurations.
1486
+ *
1487
+ * @see {@link formatPercent}
1488
+ *
1489
+ * @usageNotes
1490
+ * The following code shows how the pipe transforms numbers
1491
+ * into text strings, according to various format specifications,
1492
+ * where the caller's default locale is `en-US`.
1493
+ *
1494
+ * {@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
1495
+ *
1496
+ * @publicApi
1497
+ */
1498
+ declare class PercentPipe implements PipeTransform {
1499
+ private _locale;
1500
+ constructor(_locale: string);
1501
+ transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
1502
+ transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
1503
+ transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
1504
+ static ɵfac: i0.ɵɵFactoryDeclaration<PercentPipe, never>;
1505
+ static ɵpipe: i0.ɵɵPipeDeclaration<PercentPipe, "percent", true>;
1506
+ }
1507
+ /**
1508
+ * @ngModule CommonModule
1509
+ * @description
1510
+ *
1511
+ * Transforms a number to a currency string, formatted according to locale rules
1512
+ * that determine group sizing and separator, decimal-point character,
1513
+ * and other locale-specific configurations.
1514
+ *
1515
+ *
1516
+ * @see {@link getCurrencySymbol}
1517
+ * @see {@link formatCurrency}
1518
+ *
1519
+ * @usageNotes
1520
+ * The following code shows how the pipe transforms numbers
1521
+ * into text strings, according to various format specifications,
1522
+ * where the caller's default locale is `en-US`.
1523
+ *
1524
+ * {@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
1525
+ *
1526
+ * @publicApi
1527
+ */
1528
+ declare class CurrencyPipe implements PipeTransform {
1529
+ private _locale;
1530
+ private _defaultCurrencyCode;
1531
+ constructor(_locale: string, _defaultCurrencyCode?: string);
1532
+ /**
1533
+ *
1534
+ * @param value The number to be formatted as currency.
1535
+ * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,
1536
+ * such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be
1537
+ * configured using the `DEFAULT_CURRENCY_CODE` injection token.
1538
+ * @param display The format for the currency indicator. One of the following:
1539
+ * - `code`: Show the code (such as `USD`).
1540
+ * - `symbol`(default): Show the symbol (such as `$`).
1541
+ * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their
1542
+ * currency.
1543
+ * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the
1544
+ * locale has no narrow symbol, uses the standard symbol for the locale.
1545
+ * - String: Use the given string value instead of a code or a symbol.
1546
+ * For example, an empty string will suppress the currency & symbol.
1547
+ * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
1548
+ *
1549
+ * @param digitsInfo Decimal representation options, specified by a string
1550
+ * in the following format:<br>
1551
+ * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
1552
+ * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
1553
+ * Default is `1`.
1554
+ * - `minFractionDigits`: The minimum number of digits after the decimal point.
1555
+ * Default is `2`.
1556
+ * - `maxFractionDigits`: The maximum number of digits after the decimal point.
1557
+ * Default is `2`.
1558
+ * If not provided, the number will be formatted with the proper amount of digits,
1559
+ * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.
1560
+ * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.
1561
+ * @param locale A locale code for the locale format rules to use.
1562
+ * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
1563
+ * See [Setting your app locale](guide/i18n/locale-id).
1564
+ */
1565
+ transform(value: number | string, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
1566
+ transform(value: null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): null;
1567
+ transform(value: number | string | null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
1568
+ static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyPipe, never>;
1569
+ static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency", true>;
1570
+ }
1571
+
1572
+ /**
1573
+ * An interface that describes the date pipe configuration, which can be provided using the
1574
+ * `DATE_PIPE_DEFAULT_OPTIONS` token.
1575
+ *
1576
+ * @see {@link DATE_PIPE_DEFAULT_OPTIONS}
1577
+ *
1578
+ * @publicApi
1579
+ */
1580
+ interface DatePipeConfig {
1581
+ dateFormat?: string;
1582
+ timezone?: string;
1583
+ }
1584
+
1585
+ /**
1586
+ * Optionally-provided default timezone to use for all instances of `DatePipe` (such as `'+0430'`).
1587
+ * If the value isn't provided, the `DatePipe` will use the end-user's local system timezone.
1588
+ *
1589
+ * @deprecated use DATE_PIPE_DEFAULT_OPTIONS token to configure DatePipe
1590
+ */
1591
+ declare const DATE_PIPE_DEFAULT_TIMEZONE: InjectionToken<string>;
1592
+ /**
1593
+ * DI token that allows to provide default configuration for the `DatePipe` instances in an
1594
+ * application. The value is an object which can include the following fields:
1595
+ * - `dateFormat`: configures the default date format. If not provided, the `DatePipe`
1596
+ * will use the 'mediumDate' as a value.
1597
+ * - `timezone`: configures the default timezone. If not provided, the `DatePipe` will
1598
+ * use the end-user's local system timezone.
1599
+ *
1600
+ * @see {@link DatePipeConfig}
1601
+ *
1602
+ * @usageNotes
1603
+ *
1604
+ * Various date pipe default values can be overwritten by providing this token with
1605
+ * the value that has this interface.
1606
+ *
1607
+ * For example:
1608
+ *
1609
+ * Override the default date format by providing a value using the token:
1610
+ * ```ts
1611
+ * providers: [
1612
+ * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {dateFormat: 'shortDate'}}
1613
+ * ]
1614
+ * ```
1615
+ *
1616
+ * Override the default timezone by providing a value using the token:
1617
+ * ```ts
1618
+ * providers: [
1619
+ * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {timezone: '-1200'}}
1620
+ * ]
1621
+ * ```
1622
+ */
1623
+ declare const DATE_PIPE_DEFAULT_OPTIONS: InjectionToken<DatePipeConfig>;
1624
+ /**
1625
+ * @ngModule CommonModule
1626
+ * @description
1627
+ *
1628
+ * Formats a date value according to locale rules.
1629
+ *
1630
+ * `DatePipe` is executed only when it detects a pure change to the input value.
1631
+ * A pure change is either a change to a primitive input value
1632
+ * (such as `String`, `Number`, `Boolean`, or `Symbol`),
1633
+ * or a changed object reference (such as `Date`, `Array`, `Function`, or `Object`).
1634
+ *
1635
+ * Note that mutating a `Date` object does not cause the pipe to be rendered again.
1636
+ * To ensure that the pipe is executed, you must create a new `Date` object.
1637
+ *
1638
+ * Only the `en-US` locale data comes with Angular. To localize dates
1639
+ * in another language, you must import the corresponding locale data.
1640
+ * See the [I18n guide](guide/i18n/format-data-locale) for more information.
1641
+ *
1642
+ * The time zone of the formatted value can be specified either by passing it in as the second
1643
+ * parameter of the pipe, or by setting the default through the `DATE_PIPE_DEFAULT_OPTIONS`
1644
+ * injection token. The value that is passed in as the second parameter takes precedence over
1645
+ * the one defined using the injection token.
1646
+ *
1647
+ * @see {@link formatDate}
1648
+ *
1649
+ *
1650
+ * @usageNotes
1651
+ *
1652
+ * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to
1653
+ * reformat the date on every change-detection cycle, treat the date as an immutable object
1654
+ * and change the reference when the pipe needs to run again.
1655
+ *
1656
+ * ### Pre-defined format options
1657
+ *
1658
+ * | Option | Equivalent to | Examples (given in `en-US` locale) |
1659
+ * |---------------|-------------------------------------|-------------------------------------------------|
1660
+ * | `'short'` | `'M/d/yy, h:mm a'` | `6/15/15, 9:03 AM` |
1661
+ * | `'medium'` | `'MMM d, y, h:mm:ss a'` | `Jun 15, 2015, 9:03:01 AM` |
1662
+ * | `'long'` | `'MMMM d, y, h:mm:ss a z'` | `June 15, 2015 at 9:03:01 AM GMT+1` |
1663
+ * | `'full'` | `'EEEE, MMMM d, y, h:mm:ss a zzzz'` | `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00` |
1664
+ * | `'shortDate'` | `'M/d/yy'` | `6/15/15` |
1665
+ * | `'mediumDate'`| `'MMM d, y'` | `Jun 15, 2015` |
1666
+ * | `'longDate'` | `'MMMM d, y'` | `June 15, 2015` |
1667
+ * | `'fullDate'` | `'EEEE, MMMM d, y'` | `Monday, June 15, 2015` |
1668
+ * | `'shortTime'` | `'h:mm a'` | `9:03 AM` |
1669
+ * | `'mediumTime'`| `'h:mm:ss a'` | `9:03:01 AM` |
1670
+ * | `'longTime'` | `'h:mm:ss a z'` | `9:03:01 AM GMT+1` |
1671
+ * | `'fullTime'` | `'h:mm:ss a zzzz'` | `9:03:01 AM GMT+01:00` |
1672
+ *
1673
+ * ### Custom format options
1674
+ *
1675
+ * You can construct a format string using symbols to specify the components
1676
+ * of a date-time value, as described in the following table.
1677
+ * Format details depend on the locale.
1678
+ * Fields marked with (*) are only available in the extra data set for the given locale.
1679
+ *
1680
+ * | Field type | Format | Description | Example Value |
1681
+ * |-------------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
1682
+ * | Era | G, GG & GGG | Abbreviated | AD |
1683
+ * | | GGGG | Wide | Anno Domini |
1684
+ * | | GGGGG | Narrow | A |
1685
+ * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
1686
+ * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
1687
+ * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
1688
+ * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
1689
+ * | ISO Week-numbering year | Y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
1690
+ * | | YY | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
1691
+ * | | YYY | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
1692
+ * | | YYYY | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
1693
+ * | Month | M | Numeric: 1 digit | 9, 12 |
1694
+ * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
1695
+ * | | MMM | Abbreviated | Sep |
1696
+ * | | MMMM | Wide | September |
1697
+ * | | MMMMM | Narrow | S |
1698
+ * | Month standalone | L | Numeric: 1 digit | 9, 12 |
1699
+ * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
1700
+ * | | LLL | Abbreviated | Sep |
1701
+ * | | LLLL | Wide | September |
1702
+ * | | LLLLL | Narrow | S |
1703
+ * | ISO Week of year | w | Numeric: minimum digits | 1... 53 |
1704
+ * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
1705
+ * | Week of month | W | Numeric: 1 digit | 1... 5 |
1706
+ * | Day of month | d | Numeric: minimum digits | 1 |
1707
+ * | | dd | Numeric: 2 digits + zero padded | 01 |
1708
+ * | Week day | E, EE & EEE | Abbreviated | Tue |
1709
+ * | | EEEE | Wide | Tuesday |
1710
+ * | | EEEEE | Narrow | T |
1711
+ * | | EEEEEE | Short | Tu |
1712
+ * | Week day standalone | c, cc | Numeric: 1 digit | 2 |
1713
+ * | | ccc | Abbreviated | Tue |
1714
+ * | | cccc | Wide | Tuesday |
1715
+ * | | ccccc | Narrow | T |
1716
+ * | | cccccc | Short | Tu |
1717
+ * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
1718
+ * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
1719
+ * | | aaaaa | Narrow | a/p |
1720
+ * | Period* | B, BB & BBB | Abbreviated | mid. |
1721
+ * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
1722
+ * | | BBBBB | Narrow | md |
1723
+ * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
1724
+ * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
1725
+ * | | bbbbb | Narrow | md |
1726
+ * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
1727
+ * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
1728
+ * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
1729
+ * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
1730
+ * | Minute | m | Numeric: minimum digits | 8, 59 |
1731
+ * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
1732
+ * | Second | s | Numeric: minimum digits | 0... 59 |
1733
+ * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
1734
+ * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
1735
+ * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
1736
+ * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
1737
+ * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
1738
+ * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
1739
+ * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
1740
+ * | | ZZZZ | Long localized GMT format | GMT-8:00 |
1741
+ * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
1742
+ * | | O, OO & OOO | Short localized GMT format | GMT-8 |
1743
+ * | | OOOO | Long localized GMT format | GMT-08:00 |
1744
+ *
1745
+ *
1746
+ * ### Format examples
1747
+ *
1748
+ * These examples transform a date into various formats,
1749
+ * assuming that `dateObj` is a JavaScript `Date` object for
1750
+ * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,
1751
+ * given in the local time for the `en-US` locale.
1752
+ *
1753
+ * ```
1754
+ * {{ dateObj | date }} // output is 'Jun 15, 2015'
1755
+ * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
1756
+ * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'
1757
+ * {{ dateObj | date:'mm:ss' }} // output is '43:11'
1758
+ * {{ dateObj | date:"MMM dd, yyyy 'at' hh:mm a" }} // output is 'Jun 15, 2015 at 09:43 PM'
1759
+ * ```
1760
+ *
1761
+ * ### Usage example
1762
+ *
1763
+ * The following component uses a date pipe to display the current date in different formats.
1764
+ *
1765
+ * ```angular-ts
1766
+ * @Component({
1767
+ * selector: 'date-pipe',
1768
+ * template: `<div>
1769
+ * <p>Today is {{today | date}}</p>
1770
+ * <p>Or if you prefer, {{today | date:'fullDate'}}</p>
1771
+ * <p>The time is {{today | date:'h:mm a z'}}</p>
1772
+ * </div>`
1773
+ * })
1774
+ * // Get the current date and time as a date-time value.
1775
+ * export class DatePipeComponent {
1776
+ * today: number = Date.now();
1777
+ * }
1778
+ * ```
1779
+ *
1780
+ * @publicApi
1781
+ */
1782
+ declare class DatePipe implements PipeTransform {
1783
+ private locale;
1784
+ private defaultTimezone?;
1785
+ private defaultOptions?;
1786
+ constructor(locale: string, defaultTimezone?: string | null | undefined, defaultOptions?: (DatePipeConfig | null) | undefined);
1787
+ /**
1788
+ * @param value The date expression: a `Date` object, a number
1789
+ * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
1790
+ * @param format The date/time components to include, using predefined options or a
1791
+ * custom format string. When not provided, the `DatePipe` looks for the value using the
1792
+ * `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads the `dateFormat` property).
1793
+ * If the token is not configured, the `mediumDate` is used as a value.
1794
+ * @param timezone A timezone offset (such as `'+0430'`). When not provided, the `DatePipe`
1795
+ * looks for the value using the `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads
1796
+ * the `timezone` property). If the token is not configured, the end-user's local system
1797
+ * timezone is used as a value.
1798
+ * @param locale A locale code for the locale format rules to use.
1799
+ * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
1800
+ * See [Setting your app locale](guide/i18n/locale-id).
1801
+ *
1802
+ * @see {@link DATE_PIPE_DEFAULT_OPTIONS}
1803
+ *
1804
+ * @returns A date string in the desired format.
1805
+ */
1806
+ transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
1807
+ transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
1808
+ transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
1809
+ static ɵfac: i0.ɵɵFactoryDeclaration<DatePipe, [null, { optional: true; }, { optional: true; }]>;
1810
+ static ɵpipe: i0.ɵɵPipeDeclaration<DatePipe, "date", true>;
1811
+ }
1812
+
1813
+ /**
1814
+ * @ngModule CommonModule
1815
+ * @description
1816
+ *
1817
+ * Maps a value to a string that pluralizes the value according to locale rules.
1818
+ *
1819
+ * @usageNotes
1820
+ *
1821
+ * ### Example
1822
+ *
1823
+ * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
1824
+ *
1825
+ * @publicApi
1826
+ */
1827
+ declare class I18nPluralPipe implements PipeTransform {
1828
+ private _localization;
1829
+ constructor(_localization: NgLocalization);
1830
+ /**
1831
+ * @param value the number to be formatted
1832
+ * @param pluralMap an object that mimics the ICU format, see
1833
+ * https://unicode-org.github.io/icu/userguide/format_parse/messages/.
1834
+ * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
1835
+ * default).
1836
+ */
1837
+ transform(value: number | null | undefined, pluralMap: {
1838
+ [count: string]: string;
1839
+ }, locale?: string): string;
1840
+ static ɵfac: i0.ɵɵFactoryDeclaration<I18nPluralPipe, never>;
1841
+ static ɵpipe: i0.ɵɵPipeDeclaration<I18nPluralPipe, "i18nPlural", true>;
1842
+ }
1843
+
1844
+ /**
1845
+ * @ngModule CommonModule
1846
+ * @description
1847
+ *
1848
+ * Generic selector that displays the string that matches the current value.
1849
+ *
1850
+ * If none of the keys of the `mapping` match the `value`, then the content
1851
+ * of the `other` key is returned when present, otherwise an empty string is returned.
1852
+ *
1853
+ * @usageNotes
1854
+ *
1855
+ * ### Example
1856
+ *
1857
+ * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
1858
+ *
1859
+ * @publicApi
1860
+ */
1861
+ declare class I18nSelectPipe implements PipeTransform {
1862
+ /**
1863
+ * @param value a string to be internationalized.
1864
+ * @param mapping an object that indicates the text that should be displayed
1865
+ * for different values of the provided `value`.
1866
+ */
1867
+ transform(value: string | null | undefined, mapping: {
1868
+ [key: string]: string;
1869
+ }): string;
1870
+ static ɵfac: i0.ɵɵFactoryDeclaration<I18nSelectPipe, never>;
1871
+ static ɵpipe: i0.ɵɵPipeDeclaration<I18nSelectPipe, "i18nSelect", true>;
1872
+ }
1873
+
1874
+ /**
1875
+ * A key value pair.
1876
+ * Usually used to represent the key value pairs from a Map or Object.
1877
+ *
1878
+ * @publicApi
1879
+ */
1880
+ interface KeyValue<K, V> {
1881
+ key: K;
1882
+ value: V;
1883
+ }
1884
+ /**
1885
+ * @ngModule CommonModule
1886
+ * @description
1887
+ *
1888
+ * Transforms Object or Map into an array of key value pairs.
1889
+ *
1890
+ * The output array will be ordered by keys.
1891
+ * By default the comparator will be by Unicode point value.
1892
+ * You can optionally pass a compareFn if your keys are complex types.
1893
+ * Passing `null` as the compareFn will use natural ordering of the input.
1894
+ *
1895
+ * @usageNotes
1896
+ * ### Examples
1897
+ *
1898
+ * This examples show how an Object or a Map can be iterated by ngFor with the use of this
1899
+ * keyvalue pipe.
1900
+ *
1901
+ * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}
1902
+ *
1903
+ * @publicApi
1904
+ */
1905
+ declare class KeyValuePipe implements PipeTransform {
1906
+ private readonly differs;
1907
+ constructor(differs: KeyValueDiffers);
1908
+ private differ;
1909
+ private keyValues;
1910
+ private compareFn;
1911
+ transform<K, V>(input: ReadonlyMap<K, V>, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>>;
1912
+ transform<K extends number, V>(input: Record<K, V>, compareFn?: ((a: KeyValue<string, V>, b: KeyValue<string, V>) => number) | null): Array<KeyValue<string, V>>;
1913
+ transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V>, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>>;
1914
+ transform(input: null | undefined, compareFn?: ((a: KeyValue<unknown, unknown>, b: KeyValue<unknown, unknown>) => number) | null): null;
1915
+ transform<K, V>(input: ReadonlyMap<K, V> | null | undefined, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>> | null;
1916
+ transform<K extends number, V>(input: Record<K, V> | null | undefined, compareFn?: ((a: KeyValue<string, V>, b: KeyValue<string, V>) => number) | null): Array<KeyValue<string, V>> | null;
1917
+ transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V> | null | undefined, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>> | null;
1918
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeyValuePipe, never>;
1919
+ static ɵpipe: i0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue", true>;
1920
+ }
1921
+
1922
+ /**
1923
+ * Exports all the basic Angular directives and pipes,
1924
+ * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.
1925
+ * Re-exported by `BrowserModule`, which is included automatically in the root
1926
+ * `AppModule` when you create a new app with the CLI `new` command.
1927
+ *
1928
+ * @publicApi
1929
+ */
1930
+ declare class CommonModule {
1931
+ static ɵfac: i0.ɵɵFactoryDeclaration<CommonModule, never>;
1932
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CommonModule, never, [typeof NgClass, typeof NgComponentOutlet, typeof NgForOf, typeof NgIf, typeof NgTemplateOutlet, typeof NgStyle, typeof NgSwitch, typeof NgSwitchCase, typeof NgSwitchDefault, typeof NgPlural, typeof NgPluralCase, typeof AsyncPipe, typeof UpperCasePipe, typeof LowerCasePipe, typeof JsonPipe, typeof SlicePipe, typeof DecimalPipe, typeof PercentPipe, typeof TitleCasePipe, typeof CurrencyPipe, typeof DatePipe, typeof I18nPluralPipe, typeof I18nSelectPipe, typeof KeyValuePipe], [typeof NgClass, typeof NgComponentOutlet, typeof NgForOf, typeof NgIf, typeof NgTemplateOutlet, typeof NgStyle, typeof NgSwitch, typeof NgSwitchCase, typeof NgSwitchDefault, typeof NgPlural, typeof NgPluralCase, typeof AsyncPipe, typeof UpperCasePipe, typeof LowerCasePipe, typeof JsonPipe, typeof SlicePipe, typeof DecimalPipe, typeof PercentPipe, typeof TitleCasePipe, typeof CurrencyPipe, typeof DatePipe, typeof I18nPluralPipe, typeof I18nSelectPipe, typeof KeyValuePipe]>;
1933
+ static ɵinj: i0.ɵɵInjectorDeclaration<CommonModule>;
1934
+ }
1935
+
1936
+ export { APP_BASE_HREF, AsyncPipe, CommonModule, CurrencyPipe, DATE_PIPE_DEFAULT_OPTIONS, DATE_PIPE_DEFAULT_TIMEZONE, DatePipe, DecimalPipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, KeyValuePipe, Location, LocationStrategy, LowerCasePipe, NgClass, NgComponentOutlet, NgForOf, NgForOfContext, NgIf, NgIfContext, NgLocaleLocalization, NgLocalization, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, PathLocationStrategy, PercentPipe, SlicePipe, TitleCasePipe, UpperCasePipe };
1937
+ export type { DatePipeConfig, KeyValue, PopStateEvent };