parent
eb999300d9
commit
725bae1921
|
@ -16,6 +16,8 @@ import {ComponentFactoryResolver, ComponentRef, Directive, Injector, Input, NgMo
|
||||||
* `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
|
* `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
|
||||||
* any existing component will get destroyed.
|
* any existing component will get destroyed.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Fine tune control
|
* ### Fine tune control
|
||||||
*
|
*
|
||||||
* You can control the component creation process by using the following optional attributes:
|
* You can control the component creation process by using the following optional attributes:
|
||||||
|
@ -50,7 +52,8 @@ import {ComponentFactoryResolver, ComponentRef, Directive, Injector, Input, NgMo
|
||||||
* ngModuleFactory: moduleFactory;">
|
* ngModuleFactory: moduleFactory;">
|
||||||
* </ng-container>
|
* </ng-container>
|
||||||
* ```
|
* ```
|
||||||
* ## Example
|
*
|
||||||
|
* ### A simple example
|
||||||
*
|
*
|
||||||
* {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
|
* {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,6 +27,8 @@ export class NgForOfContext<T> {
|
||||||
* for each instantiated template inherits from the outer context with the given loop variable
|
* for each instantiated template inherits from the outer context with the given loop variable
|
||||||
* set to the current item from the iterable.
|
* set to the current item from the iterable.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Local Variables
|
* ### Local Variables
|
||||||
*
|
*
|
||||||
* `NgForOf` provides several exported values that can be aliased to local variables:
|
* `NgForOf` provides several exported values that can be aliased to local variables:
|
||||||
|
|
|
@ -17,13 +17,16 @@ import {Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef, ɵstri
|
||||||
* - `then` template is the inline template of `ngIf` unless bound to a different value.
|
* - `then` template is the inline template of `ngIf` unless bound to a different value.
|
||||||
* - `else` template is blank unless it is bound.
|
* - `else` template is blank unless it is bound.
|
||||||
*
|
*
|
||||||
* ## Most common usage
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
|
* ### Most common usage
|
||||||
*
|
*
|
||||||
* The most common usage of the `ngIf` directive is to conditionally show the inline template as
|
* The most common usage of the `ngIf` directive is to conditionally show the inline template as
|
||||||
* seen in this example:
|
* seen in this example:
|
||||||
* {@example common/ngIf/ts/module.ts region='NgIfSimple'}
|
* {@example common/ngIf/ts/module.ts region='NgIfSimple'}
|
||||||
*
|
*
|
||||||
* ## Showing an alternative template using `else`
|
* ### Showing an alternative template using `else`
|
||||||
*
|
*
|
||||||
* If it is necessary to display a template when the `expression` is falsy use the `else` template
|
* If it is necessary to display a template when the `expression` is falsy use the `else` template
|
||||||
* binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
|
* binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
|
||||||
|
@ -32,7 +35,7 @@ import {Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef, ɵstri
|
||||||
*
|
*
|
||||||
* {@example common/ngIf/ts/module.ts region='NgIfElse'}
|
* {@example common/ngIf/ts/module.ts region='NgIfElse'}
|
||||||
*
|
*
|
||||||
* ## Using non-inlined `then` template
|
* ### Using non-inlined `then` template
|
||||||
*
|
*
|
||||||
* Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
|
* Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
|
||||||
* a binding (just like `else`). Because `then` and `else` are bindings, the template references can
|
* a binding (just like `else`). Because `then` and `else` are bindings, the template references can
|
||||||
|
@ -40,7 +43,7 @@ import {Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef, ɵstri
|
||||||
*
|
*
|
||||||
* {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
|
* {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
|
||||||
*
|
*
|
||||||
* ## Storing conditional result in a variable
|
* ### Storing conditional result in a variable
|
||||||
*
|
*
|
||||||
* A common pattern is that we need to show a set of properties from the same object. If the
|
* A common pattern is that we need to show a set of properties from the same object. If the
|
||||||
* object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
|
* object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
|
||||||
|
|
|
@ -11,11 +11,6 @@ import {Directive, EmbeddedViewRef, Input, OnChanges, SimpleChange, SimpleChange
|
||||||
/**
|
/**
|
||||||
* @ngModule CommonModule
|
* @ngModule CommonModule
|
||||||
*
|
*
|
||||||
* @usageNotes
|
|
||||||
* ```
|
|
||||||
* <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
* Inserts an embedded view from a prepared `TemplateRef`.
|
* Inserts an embedded view from a prepared `TemplateRef`.
|
||||||
|
@ -24,13 +19,17 @@ import {Directive, EmbeddedViewRef, Input, OnChanges, SimpleChange, SimpleChange
|
||||||
* `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
|
* `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
|
||||||
* by the local template `let` declarations.
|
* by the local template `let` declarations.
|
||||||
*
|
*
|
||||||
* Note: using the key `$implicit` in the context object will set its value as default.
|
* @usageNotes
|
||||||
|
* ```
|
||||||
|
* <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* ## Example
|
* Using the key `$implicit` in the context object will set its value as default.
|
||||||
|
*
|
||||||
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
|
* {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Directive({selector: '[ngTemplateOutlet]'})
|
@Directive({selector: '[ngTemplateOutlet]'})
|
||||||
export class NgTemplateOutlet implements OnChanges {
|
export class NgTemplateOutlet implements OnChanges {
|
||||||
|
|
|
@ -25,6 +25,8 @@ import {LocationChangeListener, PlatformLocation} from './platform_location';
|
||||||
* For instance, if you call `location.go('/foo')`, the browser's URL will become
|
* For instance, if you call `location.go('/foo')`, the browser's URL will become
|
||||||
* `example.com#/foo`.
|
* `example.com#/foo`.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/location/ts/hash_location_component.ts region='LocationComponent'}
|
* {@example common/location/ts/hash_location_component.ts region='LocationComponent'}
|
||||||
|
|
|
@ -27,7 +27,9 @@ export interface PopStateEvent {
|
||||||
* Depending on which {@link LocationStrategy} is used, `Location` will either persist
|
* Depending on which {@link LocationStrategy} is used, `Location` will either persist
|
||||||
* to the URL's path or the URL's hash segment.
|
* to the URL's path or the URL's hash segment.
|
||||||
*
|
*
|
||||||
* Note: it's better to use {@link Router#navigate} service to trigger route changes. Use
|
* @usageNotes
|
||||||
|
*
|
||||||
|
* It's better to use {@link Router#navigate} service to trigger route changes. Use
|
||||||
* `Location` only if you need to interact with or create normalized URLs outside of
|
* `Location` only if you need to interact with or create normalized URLs outside of
|
||||||
* routing.
|
* routing.
|
||||||
*
|
*
|
||||||
|
@ -39,6 +41,7 @@ export interface PopStateEvent {
|
||||||
* - `/my/app/user/123/` **is not** normalized
|
* - `/my/app/user/123/` **is not** normalized
|
||||||
*
|
*
|
||||||
* ### Example
|
* ### Example
|
||||||
|
*
|
||||||
* {@example common/location/ts/path_location_component.ts region='LocationComponent'}
|
* {@example common/location/ts/path_location_component.ts region='LocationComponent'}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,6 +47,8 @@ export abstract class LocationStrategy {
|
||||||
* representing the URL prefix that should be preserved when generating and recognizing
|
* representing the URL prefix that should be preserved when generating and recognizing
|
||||||
* URLs.
|
* URLs.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* ```typescript
|
* ```typescript
|
||||||
|
|
|
@ -34,6 +34,8 @@ import {LocationChangeListener, PlatformLocation} from './platform_location';
|
||||||
* `location.go('/foo')`, the browser's URL will become
|
* `location.go('/foo')`, the browser's URL will become
|
||||||
* `example.com/my/app/foo`.
|
* `example.com/my/app/foo`.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/location/ts/path_location_component.ts region='LocationComponent'}
|
* {@example common/location/ts/path_location_component.ts region='LocationComponent'}
|
||||||
|
|
|
@ -51,8 +51,9 @@ const _observableStrategy = new ObservableStrategy();
|
||||||
* changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
|
* changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
|
||||||
* potential memory leaks.
|
* potential memory leaks.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
*
|
*
|
||||||
* ## Examples
|
* ### Examples
|
||||||
*
|
*
|
||||||
* This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
|
* This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
|
||||||
* promise.
|
* promise.
|
||||||
|
@ -64,7 +65,6 @@ const _observableStrategy = new ObservableStrategy();
|
||||||
*
|
*
|
||||||
* {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
|
* {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Pipe({name: 'async', pure: false})
|
@Pipe({name: 'async', pure: false})
|
||||||
export class AsyncPipe implements OnDestroy, PipeTransform {
|
export class AsyncPipe implements OnDestroy, PipeTransform {
|
||||||
|
|
|
@ -64,6 +64,8 @@ import {DateFormatter} from './intl';
|
||||||
* - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
|
* - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
|
||||||
* browsers.
|
* browsers.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Examples
|
* ### Examples
|
||||||
*
|
*
|
||||||
* Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08)
|
* Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08)
|
||||||
|
|
|
@ -78,11 +78,12 @@ function formatNumber(
|
||||||
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
|
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
|
||||||
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
|
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'}
|
* {@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Pipe({name: 'number'})
|
@Pipe({name: 'number'})
|
||||||
export class DeprecatedDecimalPipe implements PipeTransform {
|
export class DeprecatedDecimalPipe implements PipeTransform {
|
||||||
|
@ -106,6 +107,8 @@ export class DeprecatedDecimalPipe implements PipeTransform {
|
||||||
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
|
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
|
||||||
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
|
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'}
|
* {@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'}
|
||||||
|
@ -140,6 +143,8 @@ export class DeprecatedPercentPipe implements PipeTransform {
|
||||||
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
|
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
|
||||||
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
|
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'}
|
* {@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'}
|
||||||
|
|
|
@ -18,7 +18,9 @@ const _INTERPOLATION_REGEXP: RegExp = /#/g;
|
||||||
*
|
*
|
||||||
* Maps a value to a string that pluralizes the value according to locale rules.
|
* Maps a value to a string that pluralizes the value according to locale rules.
|
||||||
*
|
*
|
||||||
* ## Example
|
* @usageNotes
|
||||||
|
*
|
||||||
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
|
* {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,7 +18,9 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
|
||||||
* If none of the keys of the `mapping` match the `value`, then the content
|
* If none of the keys of the `mapping` match the `value`, then the content
|
||||||
* of the `other` key is returned when present, otherwise an empty string is returned.
|
* of the `other` key is returned when present, otherwise an empty string is returned.
|
||||||
*
|
*
|
||||||
* ## Example
|
* @usageNotes
|
||||||
|
*
|
||||||
|
* ### Example
|
||||||
*
|
*
|
||||||
* {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
|
* {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,9 +18,8 @@ import {Pipe, PipeTransform} from '@angular/core';
|
||||||
*
|
*
|
||||||
* The following component uses a JSON pipe to convert an object
|
* The following component uses a JSON pipe to convert an object
|
||||||
* to JSON format, and displays the string in both formats for comparison.
|
* to JSON format, and displays the string in both formats for comparison.
|
||||||
|
|
||||||
* {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
|
|
||||||
*
|
*
|
||||||
|
* {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Pipe({name: 'json', pure: false})
|
@Pipe({name: 'json', pure: false})
|
||||||
|
|
|
@ -44,7 +44,6 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
|
||||||
*
|
*
|
||||||
* <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example>
|
* <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example>
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Pipe({name: 'number'})
|
@Pipe({name: 'number'})
|
||||||
export class DecimalPipe implements PipeTransform {
|
export class DecimalPipe implements PipeTransform {
|
||||||
|
|
|
@ -15,6 +15,8 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
|
||||||
*
|
*
|
||||||
* Creates a new `Array` or `String` containing a subset (slice) of the elements.
|
* Creates a new `Array` or `String` containing a subset (slice) of the elements.
|
||||||
*
|
*
|
||||||
|
* @usageNotes
|
||||||
|
*
|
||||||
* All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
|
* All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
|
||||||
* and `String.prototype.slice()`.
|
* and `String.prototype.slice()`.
|
||||||
*
|
*
|
||||||
|
@ -31,14 +33,15 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
|
||||||
*
|
*
|
||||||
* produces the following:
|
* produces the following:
|
||||||
*
|
*
|
||||||
* <li>b</li>
|
* ```html
|
||||||
* <li>c</li>
|
* <li>b</li>
|
||||||
|
* <li>c</li>
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* ## String Examples
|
* ### String Examples
|
||||||
*
|
*
|
||||||
* {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
|
* {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Pipe({name: 'slice', pure: false})
|
@Pipe({name: 'slice', pure: false})
|
||||||
|
|
Loading…
Reference in New Issue