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