@angular/common 20.0.0-next.3 → 20.0.0-next.5

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,1947 @@
1
+ /**
2
+ * @license Angular v20.0.0-next.5
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 { L as LocationChangeListener, P as PlatformLocation } from './platform_location.d-BWJDgVlg.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
+ * @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
482
+ */
483
+ declare class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {
484
+ /** Reference to the current item from the collection. */
485
+ $implicit: T;
486
+ /**
487
+ * The value of the iterable expression. Useful when the expression is
488
+ * more complex then a property access, for example when using the async pipe
489
+ * (`userStreams | async`).
490
+ */
491
+ ngForOf: U;
492
+ /** Returns an index of the current item in the collection. */
493
+ index: number;
494
+ /** Returns total amount of items in the collection. */
495
+ count: number;
496
+ constructor(
497
+ /** Reference to the current item from the collection. */
498
+ $implicit: T,
499
+ /**
500
+ * The value of the iterable expression. Useful when the expression is
501
+ * more complex then a property access, for example when using the async pipe
502
+ * (`userStreams | async`).
503
+ */
504
+ ngForOf: U,
505
+ /** Returns an index of the current item in the collection. */
506
+ index: number,
507
+ /** Returns total amount of items in the collection. */
508
+ count: number);
509
+ get first(): boolean;
510
+ get last(): boolean;
511
+ get even(): boolean;
512
+ get odd(): boolean;
513
+ }
514
+ /**
515
+ * A [structural directive](guide/directives/structural-directives) that renders
516
+ * a template for each item in a collection.
517
+ * The directive is placed on an element, which becomes the parent
518
+ * of the cloned templates.
519
+ *
520
+ * The `ngForOf` directive is generally used in the
521
+ * [shorthand form](guide/directives/structural-directives#asterisk) `*ngFor`.
522
+ * In this form, the template to be rendered for each iteration is the content
523
+ * of an anchor element containing the directive.
524
+ *
525
+ * The following example shows the shorthand syntax with some options,
526
+ * contained in an `<li>` element.
527
+ *
528
+ * ```html
529
+ * <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>
530
+ * ```
531
+ *
532
+ * The shorthand form expands into a long form that uses the `ngForOf` selector
533
+ * on an `<ng-template>` element.
534
+ * The content of the `<ng-template>` element is the `<li>` element that held the
535
+ * short-form directive.
536
+ *
537
+ * Here is the expanded version of the short-form example.
538
+ *
539
+ * ```html
540
+ * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
541
+ * <li>...</li>
542
+ * </ng-template>
543
+ * ```
544
+ *
545
+ * Angular automatically expands the shorthand syntax as it compiles the template.
546
+ * The context for each embedded view is logically merged to the current component
547
+ * context according to its lexical position.
548
+ *
549
+ * When using the shorthand syntax, Angular allows only [one structural directive
550
+ * on an element](guide/directives/structural-directives#one-per-element).
551
+ * If you want to iterate conditionally, for example,
552
+ * put the `*ngIf` on a container element that wraps the `*ngFor` element.
553
+ * For further discussion, see
554
+ * [Structural Directives](guide/directives/structural-directives#one-per-element).
555
+ *
556
+ * @usageNotes
557
+ *
558
+ * ### Local variables
559
+ *
560
+ * `NgForOf` provides exported values that can be aliased to local variables.
561
+ * For example:
562
+ *
563
+ * ```html
564
+ * <li *ngFor="let user of users; index as i; first as isFirst">
565
+ * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
566
+ * </li>
567
+ * ```
568
+ *
569
+ * The following exported values can be aliased to local variables:
570
+ *
571
+ * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
572
+ * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
573
+ * more complex then a property access, for example when using the async pipe (`userStreams |
574
+ * async`).
575
+ * - `index: number`: The index of the current item in the iterable.
576
+ * - `count: number`: The length of the iterable.
577
+ * - `first: boolean`: True when the item is the first item in the iterable.
578
+ * - `last: boolean`: True when the item is the last item in the iterable.
579
+ * - `even: boolean`: True when the item has an even index in the iterable.
580
+ * - `odd: boolean`: True when the item has an odd index in the iterable.
581
+ *
582
+ * ### Change propagation
583
+ *
584
+ * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
585
+ *
586
+ * * When an item is added, a new instance of the template is added to the DOM.
587
+ * * When an item is removed, its template instance is removed from the DOM.
588
+ * * When items are reordered, their respective templates are reordered in the DOM.
589
+ *
590
+ * Angular uses object identity to track insertions and deletions within the iterator and reproduce
591
+ * those changes in the DOM. This has important implications for animations and any stateful
592
+ * controls that are present, such as `<input>` elements that accept user input. Inserted rows can
593
+ * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
594
+ * such as user input.
595
+ * For more on animations, see [Transitions and Triggers](guide/animations/transition-and-triggers).
596
+ *
597
+ * The identities of elements in the iterator can change while the data does not.
598
+ * This can happen, for example, if the iterator is produced from an RPC to the server, and that
599
+ * RPC is re-run. Even if the data hasn't changed, the second response produces objects with
600
+ * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old
601
+ * elements were deleted and all new elements inserted).
602
+ *
603
+ * To avoid this expensive operation, you can customize the default tracking algorithm.
604
+ * by supplying the `trackBy` option to `NgForOf`.
605
+ * `trackBy` takes a function that has two arguments: `index` and `item`.
606
+ * If `trackBy` is given, Angular tracks changes by the return value of the function.
607
+ *
608
+ * @see [Structural Directives](guide/directives/structural-directives)
609
+ * @ngModule CommonModule
610
+ * @publicApi
611
+ *
612
+ * @deprecated Use the @for block instead. Intent to remove in v22
613
+ */
614
+ declare class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCheck {
615
+ private _viewContainer;
616
+ private _template;
617
+ private _differs;
618
+ /**
619
+ * The value of the iterable expression, which can be used as a
620
+ * [template input variable](guide/directives/structural-directives#shorthand).
621
+ */
622
+ set ngForOf(ngForOf: (U & NgIterable<T>) | undefined | null);
623
+ /**
624
+ * Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.
625
+ *
626
+ * If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object
627
+ * identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
628
+ * as the key.
629
+ *
630
+ * `NgForOf` uses the computed key to associate items in an iterable with DOM elements
631
+ * it produces for these items.
632
+ *
633
+ * A custom `TrackByFunction` is useful to provide good user experience in cases when items in an
634
+ * iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a
635
+ * primary key), and this iterable could be updated with new object instances that still
636
+ * represent the same underlying entity (for example, when data is re-fetched from the server,
637
+ * and the iterable is recreated and re-rendered, but most of the data is still the same).
638
+ *
639
+ * @see {@link TrackByFunction}
640
+ */
641
+ set ngForTrackBy(fn: TrackByFunction<T>);
642
+ get ngForTrackBy(): TrackByFunction<T>;
643
+ private _ngForOf;
644
+ private _ngForOfDirty;
645
+ private _differ;
646
+ private _trackByFn;
647
+ constructor(_viewContainer: ViewContainerRef, _template: TemplateRef<NgForOfContext<T, U>>, _differs: IterableDiffers);
648
+ /**
649
+ * A reference to the template that is stamped out for each item in the iterable.
650
+ * @see [template reference variable](guide/templates/variables#template-reference-variables)
651
+ */
652
+ set ngForTemplate(value: TemplateRef<NgForOfContext<T, U>>);
653
+ /**
654
+ * Applies the changes when needed.
655
+ * @nodoc
656
+ */
657
+ ngDoCheck(): void;
658
+ private _applyChanges;
659
+ /**
660
+ * Asserts the correct type of the context for the template that `NgForOf` will render.
661
+ *
662
+ * The presence of this method is a signal to the Ivy template type-check compiler that the
663
+ * `NgForOf` structural directive renders its template with a specific context type.
664
+ */
665
+ static ngTemplateContextGuard<T, U extends NgIterable<T>>(dir: NgForOf<T, U>, ctx: any): ctx is NgForOfContext<T, U>;
666
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgForOf<any, any>, never>;
667
+ 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>;
668
+ }
669
+
670
+ /**
671
+ * A structural directive that conditionally includes a template based on the value of
672
+ * an expression coerced to Boolean.
673
+ * When the expression evaluates to true, Angular renders the template
674
+ * provided in a `then` clause, and when false or null,
675
+ * Angular renders the template provided in an optional `else` clause. The default
676
+ * template for the `else` clause is blank.
677
+ *
678
+ * A [shorthand form](guide/directives/structural-directives#asterisk) of the directive,
679
+ * `*ngIf="condition"`, is generally used, provided
680
+ * as an attribute of the anchor element for the inserted template.
681
+ * Angular expands this into a more explicit version, in which the anchor element
682
+ * is contained in an `<ng-template>` element.
683
+ *
684
+ * Simple form with shorthand syntax:
685
+ *
686
+ * ```html
687
+ * <div *ngIf="condition">Content to render when condition is true.</div>
688
+ * ```
689
+ *
690
+ * Simple form with expanded syntax:
691
+ *
692
+ * ```html
693
+ * <ng-template [ngIf]="condition"><div>Content to render when condition is
694
+ * true.</div></ng-template>
695
+ * ```
696
+ *
697
+ * Form with an "else" block:
698
+ *
699
+ * ```html
700
+ * <div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
701
+ * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
702
+ * ```
703
+ *
704
+ * Shorthand form with "then" and "else" blocks:
705
+ *
706
+ * ```html
707
+ * <div *ngIf="condition; then thenBlock else elseBlock"></div>
708
+ * <ng-template #thenBlock>Content to render when condition is true.</ng-template>
709
+ * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
710
+ * ```
711
+ *
712
+ * Form with storing the value locally:
713
+ *
714
+ * ```html
715
+ * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
716
+ * <ng-template #elseBlock>Content to render when value is null.</ng-template>
717
+ * ```
718
+ *
719
+ * @usageNotes
720
+ *
721
+ * The `*ngIf` directive is most commonly used to conditionally show an inline template,
722
+ * as seen in the following example.
723
+ * The default `else` template is blank.
724
+ *
725
+ * {@example common/ngIf/ts/module.ts region='NgIfSimple'}
726
+ *
727
+ * ### Showing an alternative template using `else`
728
+ *
729
+ * To display a template when `expression` evaluates to false, use an `else` template
730
+ * binding as shown in the following example.
731
+ * The `else` binding points to an `<ng-template>` element labeled `#elseBlock`.
732
+ * The template can be defined anywhere in the component view, but is typically placed right after
733
+ * `ngIf` for readability.
734
+ *
735
+ * {@example common/ngIf/ts/module.ts region='NgIfElse'}
736
+ *
737
+ * ### Using an external `then` template
738
+ *
739
+ * In the previous example, the then-clause template is specified inline, as the content of the
740
+ * tag that contains the `ngIf` directive. You can also specify a template that is defined
741
+ * externally, by referencing a labeled `<ng-template>` element. When you do this, you can
742
+ * change which template to use at runtime, as shown in the following example.
743
+ *
744
+ * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
745
+ *
746
+ * ### Storing a conditional result in a variable
747
+ *
748
+ * You might want to show a set of properties from the same object. If you are waiting
749
+ * for asynchronous data, the object can be undefined.
750
+ * In this case, you can use `ngIf` and store the result of the condition in a local
751
+ * variable as shown in the following example.
752
+ *
753
+ * {@example common/ngIf/ts/module.ts region='NgIfAs'}
754
+ *
755
+ * This code uses only one `AsyncPipe`, so only one subscription is created.
756
+ * The conditional statement stores the result of `userStream|async` in the local variable `user`.
757
+ * You can then bind the local `user` repeatedly.
758
+ *
759
+ * The conditional displays the data only if `userStream` returns a value,
760
+ * so you don't need to use the
761
+ * safe-navigation-operator (`?.`)
762
+ * to guard against null values when accessing properties.
763
+ * You can display an alternative template while waiting for the data.
764
+ *
765
+ * ### Shorthand syntax
766
+ *
767
+ * The shorthand syntax `*ngIf` expands into two separate template specifications
768
+ * for the "then" and "else" clauses. For example, consider the following shorthand statement,
769
+ * that is meant to show a loading page while waiting for data to be loaded.
770
+ *
771
+ * ```html
772
+ * <div class="hero-list" *ngIf="heroes else loading">
773
+ * ...
774
+ * </div>
775
+ *
776
+ * <ng-template #loading>
777
+ * <div>Loading...</div>
778
+ * </ng-template>
779
+ * ```
780
+ *
781
+ * You can see that the "else" clause references the `<ng-template>`
782
+ * with the `#loading` label, and the template for the "then" clause
783
+ * is provided as the content of the anchor element.
784
+ *
785
+ * However, when Angular expands the shorthand syntax, it creates
786
+ * another `<ng-template>` tag, with `ngIf` and `ngIfElse` directives.
787
+ * The anchor element containing the template for the "then" clause becomes
788
+ * the content of this unlabeled `<ng-template>` tag.
789
+ *
790
+ * ```html
791
+ * <ng-template [ngIf]="heroes" [ngIfElse]="loading">
792
+ * <div class="hero-list">
793
+ * ...
794
+ * </div>
795
+ * </ng-template>
796
+ *
797
+ * <ng-template #loading>
798
+ * <div>Loading...</div>
799
+ * </ng-template>
800
+ * ```
801
+ *
802
+ * The presence of the implicit template object has implications for the nesting of
803
+ * structural directives. For more on this subject, see
804
+ * [Structural Directives](guide/directives/structural-directives#one-per-element).
805
+ *
806
+ * @ngModule CommonModule
807
+ * @publicApi
808
+ *
809
+ * @deprecated Use the @if block instead. Intent to remove in v22
810
+ */
811
+ declare class NgIf<T = unknown> {
812
+ private _viewContainer;
813
+ private _context;
814
+ private _thenTemplateRef;
815
+ private _elseTemplateRef;
816
+ private _thenViewRef;
817
+ private _elseViewRef;
818
+ constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext<T>>);
819
+ /**
820
+ * The Boolean expression to evaluate as the condition for showing a template.
821
+ */
822
+ set ngIf(condition: T);
823
+ /**
824
+ * A template to show if the condition expression evaluates to true.
825
+ */
826
+ set ngIfThen(templateRef: TemplateRef<NgIfContext<T>> | null);
827
+ /**
828
+ * A template to show if the condition expression evaluates to false.
829
+ */
830
+ set ngIfElse(templateRef: TemplateRef<NgIfContext<T>> | null);
831
+ private _updateView;
832
+ /**
833
+ * Assert the correct type of the expression bound to the `ngIf` input within the template.
834
+ *
835
+ * The presence of this static field is a signal to the Ivy template type check compiler that
836
+ * when the `NgIf` structural directive renders its template, the type of the expression bound
837
+ * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
838
+ * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
839
+ */
840
+ static ngTemplateGuard_ngIf: 'binding';
841
+ /**
842
+ * Asserts the correct type of the context for the template that `NgIf` will render.
843
+ *
844
+ * The presence of this method is a signal to the Ivy template type-check compiler that the
845
+ * `NgIf` structural directive renders its template with a specific context type.
846
+ */
847
+ static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): ctx is NgIfContext<Exclude<T, false | 0 | '' | null | undefined>>;
848
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgIf<any>, never>;
849
+ 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>;
850
+ }
851
+ /**
852
+ * @publicApi
853
+ */
854
+ declare class NgIfContext<T = unknown> {
855
+ $implicit: T;
856
+ ngIf: T;
857
+ }
858
+
859
+ /**
860
+ * @ngModule CommonModule
861
+ *
862
+ * @description
863
+ *
864
+ * Inserts an embedded view from a prepared `TemplateRef`.
865
+ *
866
+ * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
867
+ * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
868
+ * by the local template `let` declarations.
869
+ *
870
+ * @usageNotes
871
+ * ```html
872
+ * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
873
+ * ```
874
+ *
875
+ * Using the key `$implicit` in the context object will set its value as default.
876
+ *
877
+ * ### Example
878
+ *
879
+ * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
880
+ *
881
+ * @publicApi
882
+ */
883
+ declare class NgTemplateOutlet<C = unknown> implements OnChanges {
884
+ private _viewContainerRef;
885
+ private _viewRef;
886
+ /**
887
+ * A context object to attach to the {@link EmbeddedViewRef}. This should be an
888
+ * object, the object's keys will be available for binding by the local template `let`
889
+ * declarations.
890
+ * Using the key `$implicit` in the context object will set its value as default.
891
+ */
892
+ ngTemplateOutletContext: C | null;
893
+ /**
894
+ * A string defining the template reference and optionally the context object for the template.
895
+ */
896
+ ngTemplateOutlet: TemplateRef<C> | null;
897
+ /** Injector to be used within the embedded view. */
898
+ ngTemplateOutletInjector: Injector | null;
899
+ constructor(_viewContainerRef: ViewContainerRef);
900
+ ngOnChanges(changes: SimpleChanges): void;
901
+ /**
902
+ * We need to re-create existing embedded view if either is true:
903
+ * - the outlet changed.
904
+ * - the injector changed.
905
+ */
906
+ private _shouldRecreateView;
907
+ /**
908
+ * For a given outlet instance, we create a proxy object that delegates
909
+ * to the user-specified context. This allows changing, or swapping out
910
+ * the context object completely without having to destroy/re-create the view.
911
+ */
912
+ private _createContextForwardProxy;
913
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgTemplateOutlet<any>, never>;
914
+ 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>;
915
+ }
916
+
917
+ /**
918
+ * @ngModule CommonModule
919
+ *
920
+ * @usageNotes
921
+ *
922
+ * Set the width of the containing element to a pixel value returned by an expression.
923
+ *
924
+ * ```html
925
+ * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
926
+ * ```
927
+ *
928
+ * Set a collection of style values using an expression that returns key-value pairs.
929
+ *
930
+ * ```html
931
+ * <some-element [ngStyle]="objExp">...</some-element>
932
+ * ```
933
+ *
934
+ * For more simple use cases you can use the [style bindings](/guide/templates/binding#css-class-and-style-property-bindings) directly.
935
+ * It doesn't require importing a directive.
936
+ *
937
+ * Set the font of the containing element to the result of an expression.
938
+ *
939
+ * ```html
940
+ * <some-element [style]="{'font-style': styleExp}">...</some-element>
941
+ * ```
942
+ *
943
+ * @description
944
+ *
945
+ * An attribute directive that updates styles for the containing HTML element.
946
+ * Sets one or more style properties, specified as colon-separated key-value pairs.
947
+ * The key is a style name, with an optional `.<unit>` suffix
948
+ * (such as 'top.px', 'font-style.em').
949
+ * The value is an expression to be evaluated.
950
+ * The resulting non-null value, expressed in the given unit,
951
+ * is assigned to the given style property.
952
+ * If the result of evaluation is null, the corresponding style is removed.
953
+ *
954
+ * @see [Style bindings](/guide/templates/binding#css-class-and-style-property-bindings)
955
+ *
956
+ * @publicApi
957
+ */
958
+ declare class NgStyle implements DoCheck {
959
+ private _ngEl;
960
+ private _differs;
961
+ private _renderer;
962
+ private _ngStyle;
963
+ private _differ;
964
+ constructor(_ngEl: ElementRef, _differs: KeyValueDiffers, _renderer: Renderer2);
965
+ set ngStyle(values: {
966
+ [klass: string]: any;
967
+ } | null | undefined);
968
+ ngDoCheck(): void;
969
+ private _setStyle;
970
+ private _applyChanges;
971
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgStyle, never>;
972
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgStyle, "[ngStyle]", never, { "ngStyle": { "alias": "ngStyle"; "required": false; }; }, {}, never, never, true, never>;
973
+ }
974
+
975
+ declare class SwitchView {
976
+ private _viewContainerRef;
977
+ private _templateRef;
978
+ private _created;
979
+ constructor(_viewContainerRef: ViewContainerRef, _templateRef: TemplateRef<Object>);
980
+ create(): void;
981
+ destroy(): void;
982
+ enforceState(created: boolean): void;
983
+ }
984
+ /**
985
+ * @ngModule CommonModule
986
+ *
987
+ * @description
988
+ * The `[ngSwitch]` directive on a container specifies an expression to match against.
989
+ * The expressions to match are provided by `ngSwitchCase` directives on views within the container.
990
+ * - Every view that matches is rendered.
991
+ * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered.
992
+ * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase`
993
+ * or `ngSwitchDefault` directive are preserved at the location.
994
+ *
995
+ * @usageNotes
996
+ * Define a container element for the directive, and specify the switch expression
997
+ * to match against as an attribute:
998
+ *
999
+ * ```html
1000
+ * <container-element [ngSwitch]="switch_expression">
1001
+ * ```
1002
+ *
1003
+ * Within the container, `*ngSwitchCase` statements specify the match expressions
1004
+ * as attributes. Include `*ngSwitchDefault` as the final case.
1005
+ *
1006
+ * ```html
1007
+ * <container-element [ngSwitch]="switch_expression">
1008
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1009
+ * ...
1010
+ * <some-element *ngSwitchDefault>...</some-element>
1011
+ * </container-element>
1012
+ * ```
1013
+ *
1014
+ * ### Usage Examples
1015
+ *
1016
+ * The following example shows how to use more than one case to display the same view:
1017
+ *
1018
+ * ```html
1019
+ * <container-element [ngSwitch]="switch_expression">
1020
+ * <!-- the same view can be shown in more than one case -->
1021
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1022
+ * <some-element *ngSwitchCase="match_expression_2">...</some-element>
1023
+ * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
1024
+ * <!--default case when there are no matches -->
1025
+ * <some-element *ngSwitchDefault>...</some-element>
1026
+ * </container-element>
1027
+ * ```
1028
+ *
1029
+ * The following example shows how cases can be nested:
1030
+ * ```html
1031
+ * <container-element [ngSwitch]="switch_expression">
1032
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1033
+ * <some-element *ngSwitchCase="match_expression_2">...</some-element>
1034
+ * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
1035
+ * <ng-container *ngSwitchCase="match_expression_3">
1036
+ * <!-- use a ng-container to group multiple root nodes -->
1037
+ * <inner-element></inner-element>
1038
+ * <inner-other-element></inner-other-element>
1039
+ * </ng-container>
1040
+ * <some-element *ngSwitchDefault>...</some-element>
1041
+ * </container-element>
1042
+ * ```
1043
+ *
1044
+ * @publicApi
1045
+ * @see {@link NgSwitchCase}
1046
+ * @see {@link NgSwitchDefault}
1047
+ * @see [Structural Directives](guide/directives/structural-directives)
1048
+ *
1049
+ * @deprecated Use the @switch block instead. Intent to remove in v22
1050
+ */
1051
+ declare class NgSwitch {
1052
+ private _defaultViews;
1053
+ private _defaultUsed;
1054
+ private _caseCount;
1055
+ private _lastCaseCheckIndex;
1056
+ private _lastCasesMatched;
1057
+ private _ngSwitch;
1058
+ set ngSwitch(newValue: any);
1059
+ private _updateDefaultCases;
1060
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitch, never>;
1061
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitch, "[ngSwitch]", never, { "ngSwitch": { "alias": "ngSwitch"; "required": false; }; }, {}, never, never, true, never>;
1062
+ }
1063
+ /**
1064
+ * @ngModule CommonModule
1065
+ *
1066
+ * @description
1067
+ * Provides a switch case expression to match against an enclosing `ngSwitch` expression.
1068
+ * When the expressions match, the given `NgSwitchCase` template is rendered.
1069
+ * If multiple match expressions match the switch expression value, all of them are displayed.
1070
+ *
1071
+ * @usageNotes
1072
+ *
1073
+ * Within a switch container, `*ngSwitchCase` statements specify the match expressions
1074
+ * as attributes. Include `*ngSwitchDefault` as the final case.
1075
+ *
1076
+ * ```html
1077
+ * <container-element [ngSwitch]="switch_expression">
1078
+ * <some-element *ngSwitchCase="match_expression_1">...</some-element>
1079
+ * ...
1080
+ * <some-element *ngSwitchDefault>...</some-element>
1081
+ * </container-element>
1082
+ * ```
1083
+ *
1084
+ * Each switch-case statement contains an in-line HTML template or template reference
1085
+ * that defines the subtree to be selected if the value of the match expression
1086
+ * matches the value of the switch expression.
1087
+ *
1088
+ * As of Angular v17 the NgSwitch directive uses strict equality comparison (`===`) instead of
1089
+ * loose equality (`==`) to match different cases.
1090
+ *
1091
+ * @publicApi
1092
+ * @see {@link NgSwitch}
1093
+ * @see {@link NgSwitchDefault}
1094
+ *
1095
+ * @deprecated Use the @case block within a @switch block instead. Intent to remove in v22
1096
+ */
1097
+ declare class NgSwitchCase implements DoCheck {
1098
+ private ngSwitch;
1099
+ private _view;
1100
+ /**
1101
+ * Stores the HTML template to be selected on match.
1102
+ */
1103
+ ngSwitchCase: any;
1104
+ constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
1105
+ /**
1106
+ * Performs case matching. For internal use only.
1107
+ * @nodoc
1108
+ */
1109
+ ngDoCheck(): void;
1110
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchCase, [null, null, { optional: true; host: true; }]>;
1111
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchCase, "[ngSwitchCase]", never, { "ngSwitchCase": { "alias": "ngSwitchCase"; "required": false; }; }, {}, never, never, true, never>;
1112
+ }
1113
+ /**
1114
+ * @ngModule CommonModule
1115
+ *
1116
+ * @description
1117
+ *
1118
+ * Creates a view that is rendered when no `NgSwitchCase` expressions
1119
+ * match the `NgSwitch` expression.
1120
+ * This statement should be the final case in an `NgSwitch`.
1121
+ *
1122
+ * @publicApi
1123
+ * @see {@link NgSwitch}
1124
+ * @see {@link NgSwitchCase}
1125
+ *
1126
+ * @deprecated Use the @default block within a @switch block instead. Intent to remove in v22
1127
+ */
1128
+ declare class NgSwitchDefault {
1129
+ constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
1130
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchDefault, [null, null, { optional: true; host: true; }]>;
1131
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchDefault, "[ngSwitchDefault]", never, {}, {}, never, never, true, never>;
1132
+ }
1133
+
1134
+ /**
1135
+ * @ngModule CommonModule
1136
+ *
1137
+ * @usageNotes
1138
+ * ```html
1139
+ * <some-element [ngPlural]="value">
1140
+ * <ng-template ngPluralCase="=0">there is nothing</ng-template>
1141
+ * <ng-template ngPluralCase="=1">there is one</ng-template>
1142
+ * <ng-template ngPluralCase="few">there are a few</ng-template>
1143
+ * </some-element>
1144
+ * ```
1145
+ *
1146
+ * @description
1147
+ *
1148
+ * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
1149
+ *
1150
+ * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
1151
+ * that match the switch expression's pluralization category.
1152
+ *
1153
+ * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
1154
+ * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
1155
+ * expression:
1156
+ * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
1157
+ * matches the switch expression exactly,
1158
+ * - otherwise, the view will be treated as a "category match", and will only display if exact
1159
+ * value matches aren't found and the value maps to its category for the defined locale.
1160
+ *
1161
+ * See http://cldr.unicode.org/index/cldr-spec/plural-rules
1162
+ *
1163
+ * @publicApi
1164
+ */
1165
+ declare class NgPlural {
1166
+ private _localization;
1167
+ private _activeView?;
1168
+ private _caseViews;
1169
+ constructor(_localization: NgLocalization);
1170
+ set ngPlural(value: number);
1171
+ addCase(value: string, switchView: SwitchView): void;
1172
+ private _updateView;
1173
+ private _clearViews;
1174
+ private _activateView;
1175
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgPlural, never>;
1176
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgPlural, "[ngPlural]", never, { "ngPlural": { "alias": "ngPlural"; "required": false; }; }, {}, never, never, true, never>;
1177
+ }
1178
+ /**
1179
+ * @ngModule CommonModule
1180
+ *
1181
+ * @description
1182
+ *
1183
+ * Creates a view that will be added/removed from the parent {@link NgPlural} when the
1184
+ * given expression matches the plural expression according to CLDR rules.
1185
+ *
1186
+ * @usageNotes
1187
+ * ```html
1188
+ * <some-element [ngPlural]="value">
1189
+ * <ng-template ngPluralCase="=0">...</ng-template>
1190
+ * <ng-template ngPluralCase="other">...</ng-template>
1191
+ * </some-element>
1192
+ *```
1193
+ *
1194
+ * See {@link NgPlural} for more details and example.
1195
+ *
1196
+ * @publicApi
1197
+ */
1198
+ declare class NgPluralCase {
1199
+ value: string;
1200
+ constructor(value: string, template: TemplateRef<Object>, viewContainer: ViewContainerRef, ngPlural: NgPlural);
1201
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgPluralCase, [{ attribute: "ngPluralCase"; }, null, null, { host: true; }]>;
1202
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgPluralCase, "[ngPluralCase]", never, {}, {}, never, never, true, never>;
1203
+ }
1204
+
1205
+ /**
1206
+ * @ngModule CommonModule
1207
+ * @description
1208
+ *
1209
+ * Unwraps a value from an asynchronous primitive.
1210
+ *
1211
+ * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
1212
+ * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
1213
+ * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
1214
+ * potential memory leaks. When the reference of the expression changes, the `async` pipe
1215
+ * automatically unsubscribes from the old `Observable` or `Promise` and subscribes to the new one.
1216
+ *
1217
+ * @usageNotes
1218
+ *
1219
+ * ### Examples
1220
+ *
1221
+ * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
1222
+ * promise.
1223
+ *
1224
+ * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
1225
+ *
1226
+ * It's also possible to use `async` with Observables. The example below binds the `time` Observable
1227
+ * to the view. The Observable continuously updates the view with the current time.
1228
+ *
1229
+ * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
1230
+ *
1231
+ * @publicApi
1232
+ */
1233
+ declare class AsyncPipe implements OnDestroy, PipeTransform {
1234
+ private _ref;
1235
+ private _latestValue;
1236
+ private markForCheckOnValueUpdate;
1237
+ private _subscription;
1238
+ private _obj;
1239
+ private _strategy;
1240
+ private readonly applicationErrorHandler;
1241
+ constructor(ref: ChangeDetectorRef);
1242
+ ngOnDestroy(): void;
1243
+ transform<T>(obj: Observable<T> | Subscribable<T> | PromiseLike<T>): T | null;
1244
+ transform<T>(obj: null | undefined): null;
1245
+ transform<T>(obj: Observable<T> | Subscribable<T> | PromiseLike<T> | null | undefined): T | null;
1246
+ private _subscribe;
1247
+ private _selectStrategy;
1248
+ private _dispose;
1249
+ private _updateLatestValue;
1250
+ static ɵfac: i0.ɵɵFactoryDeclaration<AsyncPipe, never>;
1251
+ static ɵpipe: i0.ɵɵPipeDeclaration<AsyncPipe, "async", true>;
1252
+ }
1253
+
1254
+ /**
1255
+ * Transforms text to all lower case.
1256
+ *
1257
+ * @see {@link UpperCasePipe}
1258
+ * @see {@link TitleCasePipe}
1259
+ * @usageNotes
1260
+ *
1261
+ * The following example defines a view that allows the user to enter
1262
+ * text, and then uses the pipe to convert the input text to all lower case.
1263
+ *
1264
+ * {@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe'}
1265
+ *
1266
+ * @ngModule CommonModule
1267
+ * @publicApi
1268
+ */
1269
+ declare class LowerCasePipe implements PipeTransform {
1270
+ /**
1271
+ * @param value The string to transform to lower case.
1272
+ */
1273
+ transform(value: string): string;
1274
+ transform(value: null | undefined): null;
1275
+ transform(value: string | null | undefined): string | null;
1276
+ static ɵfac: i0.ɵɵFactoryDeclaration<LowerCasePipe, never>;
1277
+ static ɵpipe: i0.ɵɵPipeDeclaration<LowerCasePipe, "lowercase", true>;
1278
+ }
1279
+ /**
1280
+ * Transforms text to title case.
1281
+ * Capitalizes the first letter of each word and transforms the
1282
+ * rest of the word to lower case.
1283
+ * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.
1284
+ *
1285
+ * @see {@link LowerCasePipe}
1286
+ * @see {@link UpperCasePipe}
1287
+ *
1288
+ * @usageNotes
1289
+ * The following example shows the result of transforming various strings into title case.
1290
+ *
1291
+ * {@example common/pipes/ts/titlecase_pipe.ts region='TitleCasePipe'}
1292
+ *
1293
+ * @ngModule CommonModule
1294
+ * @publicApi
1295
+ */
1296
+ declare class TitleCasePipe implements PipeTransform {
1297
+ /**
1298
+ * @param value The string to transform to title case.
1299
+ */
1300
+ transform(value: string): string;
1301
+ transform(value: null | undefined): null;
1302
+ transform(value: string | null | undefined): string | null;
1303
+ static ɵfac: i0.ɵɵFactoryDeclaration<TitleCasePipe, never>;
1304
+ static ɵpipe: i0.ɵɵPipeDeclaration<TitleCasePipe, "titlecase", true>;
1305
+ }
1306
+ /**
1307
+ * Transforms text to all upper case.
1308
+ * @see {@link LowerCasePipe}
1309
+ * @see {@link TitleCasePipe}
1310
+ *
1311
+ * @ngModule CommonModule
1312
+ * @publicApi
1313
+ */
1314
+ declare class UpperCasePipe implements PipeTransform {
1315
+ /**
1316
+ * @param value The string to transform to upper case.
1317
+ */
1318
+ transform(value: string): string;
1319
+ transform(value: null | undefined): null;
1320
+ transform(value: string | null | undefined): string | null;
1321
+ static ɵfac: i0.ɵɵFactoryDeclaration<UpperCasePipe, never>;
1322
+ static ɵpipe: i0.ɵɵPipeDeclaration<UpperCasePipe, "uppercase", true>;
1323
+ }
1324
+
1325
+ /**
1326
+ * @ngModule CommonModule
1327
+ * @description
1328
+ *
1329
+ * Converts a value into its JSON-format representation. Useful for debugging.
1330
+ *
1331
+ * @usageNotes
1332
+ *
1333
+ * The following component uses a JSON pipe to convert an object
1334
+ * to JSON format, and displays the string in both formats for comparison.
1335
+ *
1336
+ * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
1337
+ *
1338
+ * @publicApi
1339
+ */
1340
+ declare class JsonPipe implements PipeTransform {
1341
+ /**
1342
+ * @param value A value of any type to convert into a JSON-format string.
1343
+ */
1344
+ transform(value: any): string;
1345
+ static ɵfac: i0.ɵɵFactoryDeclaration<JsonPipe, never>;
1346
+ static ɵpipe: i0.ɵɵPipeDeclaration<JsonPipe, "json", true>;
1347
+ }
1348
+
1349
+ /**
1350
+ * @ngModule CommonModule
1351
+ * @description
1352
+ *
1353
+ * Creates a new `Array` or `String` containing a subset (slice) of the elements.
1354
+ *
1355
+ * @usageNotes
1356
+ *
1357
+ * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
1358
+ * and `String.prototype.slice()`.
1359
+ *
1360
+ * When operating on an `Array`, the returned `Array` is always a copy even when all
1361
+ * the elements are being returned.
1362
+ *
1363
+ * When operating on a blank value, the pipe returns the blank value.
1364
+ *
1365
+ * ### List Example
1366
+ *
1367
+ * This `ngFor` example:
1368
+ *
1369
+ * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
1370
+ *
1371
+ * produces the following:
1372
+ *
1373
+ * ```html
1374
+ * <li>b</li>
1375
+ * <li>c</li>
1376
+ * ```
1377
+ *
1378
+ * ### String Examples
1379
+ *
1380
+ * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
1381
+ *
1382
+ * @publicApi
1383
+ */
1384
+ declare class SlicePipe implements PipeTransform {
1385
+ /**
1386
+ * @param value a list or a string to be sliced.
1387
+ * @param start the starting index of the subset to return:
1388
+ * - **a positive integer**: return the item at `start` index and all items after
1389
+ * in the list or string expression.
1390
+ * - **a negative integer**: return the item at `start` index from the end and all items after
1391
+ * in the list or string expression.
1392
+ * - **if positive and greater than the size of the expression**: return an empty list or
1393
+ * string.
1394
+ * - **if negative and greater than the size of the expression**: return entire list or string.
1395
+ * @param end the ending index of the subset to return:
1396
+ * - **omitted**: return all items until the end.
1397
+ * - **if positive**: return all items before `end` index of the list or string.
1398
+ * - **if negative**: return all items before `end` index from the end of the list or string.
1399
+ */
1400
+ transform<T>(value: ReadonlyArray<T>, start: number, end?: number): Array<T>;
1401
+ transform(value: null | undefined, start: number, end?: number): null;
1402
+ transform<T>(value: ReadonlyArray<T> | null | undefined, start: number, end?: number): Array<T> | null;
1403
+ transform(value: string, start: number, end?: number): string;
1404
+ transform(value: string | null | undefined, start: number, end?: number): string | null;
1405
+ static ɵfac: i0.ɵɵFactoryDeclaration<SlicePipe, never>;
1406
+ static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "slice", true>;
1407
+ }
1408
+
1409
+ /**
1410
+ * @ngModule CommonModule
1411
+ * @description
1412
+ *
1413
+ * Formats a value according to digit options and locale rules.
1414
+ * Locale determines group sizing and separator,
1415
+ * decimal point character, and other locale-specific configurations.
1416
+ *
1417
+ * @see {@link formatNumber}
1418
+ *
1419
+ * @usageNotes
1420
+ *
1421
+ * ### digitsInfo
1422
+ *
1423
+ * The value's decimal representation is specified by the `digitsInfo`
1424
+ * parameter, written in the following format:<br>
1425
+ *
1426
+ * ```
1427
+ * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
1428
+ * ```
1429
+ *
1430
+ * - `minIntegerDigits`:
1431
+ * The minimum number of integer digits before the decimal point.
1432
+ * Default is 1.
1433
+ *
1434
+ * - `minFractionDigits`:
1435
+ * The minimum number of digits after the decimal point.
1436
+ * Default is 0.
1437
+ *
1438
+ * - `maxFractionDigits`:
1439
+ * The maximum number of digits after the decimal point.
1440
+ * Default is 3.
1441
+ *
1442
+ * If the formatted value is truncated it will be rounded using the "to-nearest" method:
1443
+ *
1444
+ * ```
1445
+ * {{3.6 | number: '1.0-0'}}
1446
+ * <!--will output '4'-->
1447
+ *
1448
+ * {{-3.6 | number:'1.0-0'}}
1449
+ * <!--will output '-4'-->
1450
+ * ```
1451
+ *
1452
+ * ### locale
1453
+ *
1454
+ * `locale` will format a value according to locale rules.
1455
+ * Locale determines group sizing and separator,
1456
+ * decimal point character, and other locale-specific configurations.
1457
+ *
1458
+ * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
1459
+ *
1460
+ * See [Setting your app locale](guide/i18n/locale-id).
1461
+ *
1462
+ * ### Example
1463
+ *
1464
+ * The following code shows how the pipe transforms values
1465
+ * according to various format specifications,
1466
+ * where the caller's default locale is `en-US`.
1467
+ *
1468
+ * {@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
1469
+ *
1470
+ * @publicApi
1471
+ */
1472
+ declare class DecimalPipe implements PipeTransform {
1473
+ private _locale;
1474
+ constructor(_locale: string);
1475
+ /**
1476
+ * @param value The value to be formatted.
1477
+ * @param digitsInfo Sets digit and decimal representation.
1478
+ * [See more](#digitsinfo).
1479
+ * @param locale Specifies what locale format rules to use.
1480
+ * [See more](#locale).
1481
+ */
1482
+ transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
1483
+ transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
1484
+ transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
1485
+ static ɵfac: i0.ɵɵFactoryDeclaration<DecimalPipe, never>;
1486
+ static ɵpipe: i0.ɵɵPipeDeclaration<DecimalPipe, "number", true>;
1487
+ }
1488
+ /**
1489
+ * @ngModule CommonModule
1490
+ * @description
1491
+ *
1492
+ * Transforms a number to a percentage
1493
+ * string, formatted according to locale rules that determine group sizing and
1494
+ * separator, decimal-point character, and other locale-specific
1495
+ * configurations.
1496
+ *
1497
+ * @see {@link formatPercent}
1498
+ *
1499
+ * @usageNotes
1500
+ * The following code shows how the pipe transforms numbers
1501
+ * into text strings, according to various format specifications,
1502
+ * where the caller's default locale is `en-US`.
1503
+ *
1504
+ * {@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
1505
+ *
1506
+ * @publicApi
1507
+ */
1508
+ declare class PercentPipe implements PipeTransform {
1509
+ private _locale;
1510
+ constructor(_locale: string);
1511
+ transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
1512
+ transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
1513
+ transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
1514
+ static ɵfac: i0.ɵɵFactoryDeclaration<PercentPipe, never>;
1515
+ static ɵpipe: i0.ɵɵPipeDeclaration<PercentPipe, "percent", true>;
1516
+ }
1517
+ /**
1518
+ * @ngModule CommonModule
1519
+ * @description
1520
+ *
1521
+ * Transforms a number to a currency string, formatted according to locale rules
1522
+ * that determine group sizing and separator, decimal-point character,
1523
+ * and other locale-specific configurations.
1524
+ *
1525
+ *
1526
+ * @see {@link getCurrencySymbol}
1527
+ * @see {@link formatCurrency}
1528
+ *
1529
+ * @usageNotes
1530
+ * The following code shows how the pipe transforms numbers
1531
+ * into text strings, according to various format specifications,
1532
+ * where the caller's default locale is `en-US`.
1533
+ *
1534
+ * {@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
1535
+ *
1536
+ * @publicApi
1537
+ */
1538
+ declare class CurrencyPipe implements PipeTransform {
1539
+ private _locale;
1540
+ private _defaultCurrencyCode;
1541
+ constructor(_locale: string, _defaultCurrencyCode?: string);
1542
+ /**
1543
+ *
1544
+ * @param value The number to be formatted as currency.
1545
+ * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,
1546
+ * such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be
1547
+ * configured using the `DEFAULT_CURRENCY_CODE` injection token.
1548
+ * @param display The format for the currency indicator. One of the following:
1549
+ * - `code`: Show the code (such as `USD`).
1550
+ * - `symbol`(default): Show the symbol (such as `$`).
1551
+ * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their
1552
+ * currency.
1553
+ * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the
1554
+ * locale has no narrow symbol, uses the standard symbol for the locale.
1555
+ * - String: Use the given string value instead of a code or a symbol.
1556
+ * For example, an empty string will suppress the currency & symbol.
1557
+ * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
1558
+ *
1559
+ * @param digitsInfo Decimal representation options, specified by a string
1560
+ * in the following format:<br>
1561
+ * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
1562
+ * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
1563
+ * Default is `1`.
1564
+ * - `minFractionDigits`: The minimum number of digits after the decimal point.
1565
+ * Default is `2`.
1566
+ * - `maxFractionDigits`: The maximum number of digits after the decimal point.
1567
+ * Default is `2`.
1568
+ * If not provided, the number will be formatted with the proper amount of digits,
1569
+ * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.
1570
+ * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.
1571
+ * @param locale A locale code for the locale format rules to use.
1572
+ * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
1573
+ * See [Setting your app locale](guide/i18n/locale-id).
1574
+ */
1575
+ transform(value: number | string, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
1576
+ transform(value: null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): null;
1577
+ transform(value: number | string | null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
1578
+ static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyPipe, never>;
1579
+ static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency", true>;
1580
+ }
1581
+
1582
+ /**
1583
+ * An interface that describes the date pipe configuration, which can be provided using the
1584
+ * `DATE_PIPE_DEFAULT_OPTIONS` token.
1585
+ *
1586
+ * @see {@link DATE_PIPE_DEFAULT_OPTIONS}
1587
+ *
1588
+ * @publicApi
1589
+ */
1590
+ interface DatePipeConfig {
1591
+ dateFormat?: string;
1592
+ timezone?: string;
1593
+ }
1594
+
1595
+ /**
1596
+ * Optionally-provided default timezone to use for all instances of `DatePipe` (such as `'+0430'`).
1597
+ * If the value isn't provided, the `DatePipe` will use the end-user's local system timezone.
1598
+ *
1599
+ * @deprecated use DATE_PIPE_DEFAULT_OPTIONS token to configure DatePipe
1600
+ */
1601
+ declare const DATE_PIPE_DEFAULT_TIMEZONE: InjectionToken<string>;
1602
+ /**
1603
+ * DI token that allows to provide default configuration for the `DatePipe` instances in an
1604
+ * application. The value is an object which can include the following fields:
1605
+ * - `dateFormat`: configures the default date format. If not provided, the `DatePipe`
1606
+ * will use the 'mediumDate' as a value.
1607
+ * - `timezone`: configures the default timezone. If not provided, the `DatePipe` will
1608
+ * use the end-user's local system timezone.
1609
+ *
1610
+ * @see {@link DatePipeConfig}
1611
+ *
1612
+ * @usageNotes
1613
+ *
1614
+ * Various date pipe default values can be overwritten by providing this token with
1615
+ * the value that has this interface.
1616
+ *
1617
+ * For example:
1618
+ *
1619
+ * Override the default date format by providing a value using the token:
1620
+ * ```ts
1621
+ * providers: [
1622
+ * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {dateFormat: 'shortDate'}}
1623
+ * ]
1624
+ * ```
1625
+ *
1626
+ * Override the default timezone by providing a value using the token:
1627
+ * ```ts
1628
+ * providers: [
1629
+ * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {timezone: '-1200'}}
1630
+ * ]
1631
+ * ```
1632
+ */
1633
+ declare const DATE_PIPE_DEFAULT_OPTIONS: InjectionToken<DatePipeConfig>;
1634
+ /**
1635
+ * @ngModule CommonModule
1636
+ * @description
1637
+ *
1638
+ * Formats a date value according to locale rules.
1639
+ *
1640
+ * `DatePipe` is executed only when it detects a pure change to the input value.
1641
+ * A pure change is either a change to a primitive input value
1642
+ * (such as `String`, `Number`, `Boolean`, or `Symbol`),
1643
+ * or a changed object reference (such as `Date`, `Array`, `Function`, or `Object`).
1644
+ *
1645
+ * Note that mutating a `Date` object does not cause the pipe to be rendered again.
1646
+ * To ensure that the pipe is executed, you must create a new `Date` object.
1647
+ *
1648
+ * Only the `en-US` locale data comes with Angular. To localize dates
1649
+ * in another language, you must import the corresponding locale data.
1650
+ * See the [I18n guide](guide/i18n/format-data-locale) for more information.
1651
+ *
1652
+ * The time zone of the formatted value can be specified either by passing it in as the second
1653
+ * parameter of the pipe, or by setting the default through the `DATE_PIPE_DEFAULT_OPTIONS`
1654
+ * injection token. The value that is passed in as the second parameter takes precedence over
1655
+ * the one defined using the injection token.
1656
+ *
1657
+ * @see {@link formatDate}
1658
+ *
1659
+ *
1660
+ * @usageNotes
1661
+ *
1662
+ * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to
1663
+ * reformat the date on every change-detection cycle, treat the date as an immutable object
1664
+ * and change the reference when the pipe needs to run again.
1665
+ *
1666
+ * ### Pre-defined format options
1667
+ *
1668
+ * | Option | Equivalent to | Examples (given in `en-US` locale) |
1669
+ * |---------------|-------------------------------------|-------------------------------------------------|
1670
+ * | `'short'` | `'M/d/yy, h:mm a'` | `6/15/15, 9:03 AM` |
1671
+ * | `'medium'` | `'MMM d, y, h:mm:ss a'` | `Jun 15, 2015, 9:03:01 AM` |
1672
+ * | `'long'` | `'MMMM d, y, h:mm:ss a z'` | `June 15, 2015 at 9:03:01 AM GMT+1` |
1673
+ * | `'full'` | `'EEEE, MMMM d, y, h:mm:ss a zzzz'` | `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00` |
1674
+ * | `'shortDate'` | `'M/d/yy'` | `6/15/15` |
1675
+ * | `'mediumDate'`| `'MMM d, y'` | `Jun 15, 2015` |
1676
+ * | `'longDate'` | `'MMMM d, y'` | `June 15, 2015` |
1677
+ * | `'fullDate'` | `'EEEE, MMMM d, y'` | `Monday, June 15, 2015` |
1678
+ * | `'shortTime'` | `'h:mm a'` | `9:03 AM` |
1679
+ * | `'mediumTime'`| `'h:mm:ss a'` | `9:03:01 AM` |
1680
+ * | `'longTime'` | `'h:mm:ss a z'` | `9:03:01 AM GMT+1` |
1681
+ * | `'fullTime'` | `'h:mm:ss a zzzz'` | `9:03:01 AM GMT+01:00` |
1682
+ *
1683
+ * ### Custom format options
1684
+ *
1685
+ * You can construct a format string using symbols to specify the components
1686
+ * of a date-time value, as described in the following table.
1687
+ * Format details depend on the locale.
1688
+ * Fields marked with (*) are only available in the extra data set for the given locale.
1689
+ *
1690
+ * | Field type | Format | Description | Example Value |
1691
+ * |-------------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
1692
+ * | Era | G, GG & GGG | Abbreviated | AD |
1693
+ * | | GGGG | Wide | Anno Domini |
1694
+ * | | GGGGG | Narrow | A |
1695
+ * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
1696
+ * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
1697
+ * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
1698
+ * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
1699
+ * | ISO Week-numbering year | Y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
1700
+ * | | YY | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
1701
+ * | | YYY | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
1702
+ * | | YYYY | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
1703
+ * | Month | M | Numeric: 1 digit | 9, 12 |
1704
+ * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
1705
+ * | | MMM | Abbreviated | Sep |
1706
+ * | | MMMM | Wide | September |
1707
+ * | | MMMMM | Narrow | S |
1708
+ * | Month standalone | L | Numeric: 1 digit | 9, 12 |
1709
+ * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
1710
+ * | | LLL | Abbreviated | Sep |
1711
+ * | | LLLL | Wide | September |
1712
+ * | | LLLLL | Narrow | S |
1713
+ * | ISO Week of year | w | Numeric: minimum digits | 1... 53 |
1714
+ * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
1715
+ * | Week of month | W | Numeric: 1 digit | 1... 5 |
1716
+ * | Day of month | d | Numeric: minimum digits | 1 |
1717
+ * | | dd | Numeric: 2 digits + zero padded | 01 |
1718
+ * | Week day | E, EE & EEE | Abbreviated | Tue |
1719
+ * | | EEEE | Wide | Tuesday |
1720
+ * | | EEEEE | Narrow | T |
1721
+ * | | EEEEEE | Short | Tu |
1722
+ * | Week day standalone | c, cc | Numeric: 1 digit | 2 |
1723
+ * | | ccc | Abbreviated | Tue |
1724
+ * | | cccc | Wide | Tuesday |
1725
+ * | | ccccc | Narrow | T |
1726
+ * | | cccccc | Short | Tu |
1727
+ * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
1728
+ * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
1729
+ * | | aaaaa | Narrow | a/p |
1730
+ * | Period* | B, BB & BBB | Abbreviated | mid. |
1731
+ * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
1732
+ * | | BBBBB | Narrow | md |
1733
+ * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
1734
+ * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
1735
+ * | | bbbbb | Narrow | md |
1736
+ * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
1737
+ * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
1738
+ * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
1739
+ * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
1740
+ * | Minute | m | Numeric: minimum digits | 8, 59 |
1741
+ * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
1742
+ * | Second | s | Numeric: minimum digits | 0... 59 |
1743
+ * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
1744
+ * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
1745
+ * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
1746
+ * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
1747
+ * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
1748
+ * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
1749
+ * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
1750
+ * | | ZZZZ | Long localized GMT format | GMT-8:00 |
1751
+ * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
1752
+ * | | O, OO & OOO | Short localized GMT format | GMT-8 |
1753
+ * | | OOOO | Long localized GMT format | GMT-08:00 |
1754
+ *
1755
+ *
1756
+ * ### Format examples
1757
+ *
1758
+ * These examples transform a date into various formats,
1759
+ * assuming that `dateObj` is a JavaScript `Date` object for
1760
+ * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,
1761
+ * given in the local time for the `en-US` locale.
1762
+ *
1763
+ * ```
1764
+ * {{ dateObj | date }} // output is 'Jun 15, 2015'
1765
+ * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
1766
+ * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'
1767
+ * {{ dateObj | date:'mm:ss' }} // output is '43:11'
1768
+ * {{ dateObj | date:"MMM dd, yyyy 'at' hh:mm a" }} // output is 'Jun 15, 2015 at 09:43 PM'
1769
+ * ```
1770
+ *
1771
+ * ### Usage example
1772
+ *
1773
+ * The following component uses a date pipe to display the current date in different formats.
1774
+ *
1775
+ * ```angular-ts
1776
+ * @Component({
1777
+ * selector: 'date-pipe',
1778
+ * template: `<div>
1779
+ * <p>Today is {{today | date}}</p>
1780
+ * <p>Or if you prefer, {{today | date:'fullDate'}}</p>
1781
+ * <p>The time is {{today | date:'h:mm a z'}}</p>
1782
+ * </div>`
1783
+ * })
1784
+ * // Get the current date and time as a date-time value.
1785
+ * export class DatePipeComponent {
1786
+ * today: number = Date.now();
1787
+ * }
1788
+ * ```
1789
+ *
1790
+ * @publicApi
1791
+ */
1792
+ declare class DatePipe implements PipeTransform {
1793
+ private locale;
1794
+ private defaultTimezone?;
1795
+ private defaultOptions?;
1796
+ constructor(locale: string, defaultTimezone?: string | null | undefined, defaultOptions?: (DatePipeConfig | null) | undefined);
1797
+ /**
1798
+ * @param value The date expression: a `Date` object, a number
1799
+ * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
1800
+ * @param format The date/time components to include, using predefined options or a
1801
+ * custom format string. When not provided, the `DatePipe` looks for the value using the
1802
+ * `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads the `dateFormat` property).
1803
+ * If the token is not configured, the `mediumDate` is used as a value.
1804
+ * @param timezone A timezone offset (such as `'+0430'`). When not provided, the `DatePipe`
1805
+ * looks for the value using the `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads
1806
+ * the `timezone` property). If the token is not configured, the end-user's local system
1807
+ * timezone is used as a value.
1808
+ * @param locale A locale code for the locale format rules to use.
1809
+ * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
1810
+ * See [Setting your app locale](guide/i18n/locale-id).
1811
+ *
1812
+ * @see {@link DATE_PIPE_DEFAULT_OPTIONS}
1813
+ *
1814
+ * @returns A date string in the desired format.
1815
+ */
1816
+ transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
1817
+ transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
1818
+ transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
1819
+ static ɵfac: i0.ɵɵFactoryDeclaration<DatePipe, [null, { optional: true; }, { optional: true; }]>;
1820
+ static ɵpipe: i0.ɵɵPipeDeclaration<DatePipe, "date", true>;
1821
+ }
1822
+
1823
+ /**
1824
+ * @ngModule CommonModule
1825
+ * @description
1826
+ *
1827
+ * Maps a value to a string that pluralizes the value according to locale rules.
1828
+ *
1829
+ * @usageNotes
1830
+ *
1831
+ * ### Example
1832
+ *
1833
+ * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
1834
+ *
1835
+ * @publicApi
1836
+ */
1837
+ declare class I18nPluralPipe implements PipeTransform {
1838
+ private _localization;
1839
+ constructor(_localization: NgLocalization);
1840
+ /**
1841
+ * @param value the number to be formatted
1842
+ * @param pluralMap an object that mimics the ICU format, see
1843
+ * https://unicode-org.github.io/icu/userguide/format_parse/messages/.
1844
+ * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
1845
+ * default).
1846
+ */
1847
+ transform(value: number | null | undefined, pluralMap: {
1848
+ [count: string]: string;
1849
+ }, locale?: string): string;
1850
+ static ɵfac: i0.ɵɵFactoryDeclaration<I18nPluralPipe, never>;
1851
+ static ɵpipe: i0.ɵɵPipeDeclaration<I18nPluralPipe, "i18nPlural", true>;
1852
+ }
1853
+
1854
+ /**
1855
+ * @ngModule CommonModule
1856
+ * @description
1857
+ *
1858
+ * Generic selector that displays the string that matches the current value.
1859
+ *
1860
+ * If none of the keys of the `mapping` match the `value`, then the content
1861
+ * of the `other` key is returned when present, otherwise an empty string is returned.
1862
+ *
1863
+ * @usageNotes
1864
+ *
1865
+ * ### Example
1866
+ *
1867
+ * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
1868
+ *
1869
+ * @publicApi
1870
+ */
1871
+ declare class I18nSelectPipe implements PipeTransform {
1872
+ /**
1873
+ * @param value a string to be internationalized.
1874
+ * @param mapping an object that indicates the text that should be displayed
1875
+ * for different values of the provided `value`.
1876
+ */
1877
+ transform(value: string | null | undefined, mapping: {
1878
+ [key: string]: string;
1879
+ }): string;
1880
+ static ɵfac: i0.ɵɵFactoryDeclaration<I18nSelectPipe, never>;
1881
+ static ɵpipe: i0.ɵɵPipeDeclaration<I18nSelectPipe, "i18nSelect", true>;
1882
+ }
1883
+
1884
+ /**
1885
+ * A key value pair.
1886
+ * Usually used to represent the key value pairs from a Map or Object.
1887
+ *
1888
+ * @publicApi
1889
+ */
1890
+ interface KeyValue<K, V> {
1891
+ key: K;
1892
+ value: V;
1893
+ }
1894
+ /**
1895
+ * @ngModule CommonModule
1896
+ * @description
1897
+ *
1898
+ * Transforms Object or Map into an array of key value pairs.
1899
+ *
1900
+ * The output array will be ordered by keys.
1901
+ * By default the comparator will be by Unicode point value.
1902
+ * You can optionally pass a compareFn if your keys are complex types.
1903
+ * Passing `null` as the compareFn will use natural ordering of the input.
1904
+ *
1905
+ * @usageNotes
1906
+ * ### Examples
1907
+ *
1908
+ * This examples show how an Object or a Map can be iterated by ngFor with the use of this
1909
+ * keyvalue pipe.
1910
+ *
1911
+ * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}
1912
+ *
1913
+ * @publicApi
1914
+ */
1915
+ declare class KeyValuePipe implements PipeTransform {
1916
+ private readonly differs;
1917
+ constructor(differs: KeyValueDiffers);
1918
+ private differ;
1919
+ private keyValues;
1920
+ private compareFn;
1921
+ transform<K, V>(input: ReadonlyMap<K, V>, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>>;
1922
+ transform<K extends number, V>(input: Record<K, V>, compareFn?: ((a: KeyValue<string, V>, b: KeyValue<string, V>) => number) | null): Array<KeyValue<string, V>>;
1923
+ 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>>;
1924
+ transform(input: null | undefined, compareFn?: ((a: KeyValue<unknown, unknown>, b: KeyValue<unknown, unknown>) => number) | null): null;
1925
+ 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;
1926
+ 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;
1927
+ 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;
1928
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeyValuePipe, never>;
1929
+ static ɵpipe: i0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue", true>;
1930
+ }
1931
+
1932
+ /**
1933
+ * Exports all the basic Angular directives and pipes,
1934
+ * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.
1935
+ * Re-exported by `BrowserModule`, which is included automatically in the root
1936
+ * `AppModule` when you create a new app with the CLI `new` command.
1937
+ *
1938
+ * @publicApi
1939
+ */
1940
+ declare class CommonModule {
1941
+ static ɵfac: i0.ɵɵFactoryDeclaration<CommonModule, never>;
1942
+ 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]>;
1943
+ static ɵinj: i0.ɵɵInjectorDeclaration<CommonModule>;
1944
+ }
1945
+
1946
+ export { AsyncPipe as A, CommonModule as C, DatePipe as D, I18nPluralPipe as I, JsonPipe as J, KeyValuePipe as K, LocationStrategy as L, NgLocaleLocalization as N, PercentPipe as P, SlicePipe as S, TitleCasePipe as T, UpperCasePipe as U, NgLocalization as a, NgClass as b, NgForOf as c, NgForOfContext as d, NgIf as e, NgIfContext as f, NgPlural as g, NgPluralCase as h, NgStyle as i, NgSwitch as j, NgSwitchCase as k, NgSwitchDefault as l, NgTemplateOutlet as m, NgComponentOutlet as n, DATE_PIPE_DEFAULT_TIMEZONE as p, DATE_PIPE_DEFAULT_OPTIONS as q, I18nSelectPipe as r, LowerCasePipe as s, CurrencyPipe as t, DecimalPipe as u, Location as w, APP_BASE_HREF as y, PathLocationStrategy as z };
1947
+ export type { DatePipeConfig as o, KeyValue as v, PopStateEvent as x };