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