fix(common) add interface PipeTransform to Async pipe (#14049)
PR Close #14049
This commit is contained in:
parent
579567ca79
commit
94b62c963d
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ChangeDetectorRef, OnDestroy, Pipe, WrappedValue} from '@angular/core';
|
import {ChangeDetectorRef, OnDestroy, Pipe, PipeTransform, WrappedValue} from '@angular/core';
|
||||||
import {EventEmitter, Observable} from '../facade/async';
|
import {EventEmitter, Observable} from '../facade/async';
|
||||||
import {isPromise} from '../private_import_core';
|
import {isPromise} from '../private_import_core';
|
||||||
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
|
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
|
||||||
|
@ -66,7 +66,7 @@ const _observableStrategy = new ObservableStrategy();
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
@Pipe({name: 'async', pure: false})
|
@Pipe({name: 'async', pure: false})
|
||||||
export class AsyncPipe implements OnDestroy {
|
export class AsyncPipe implements OnDestroy, PipeTransform {
|
||||||
private _latestValue: Object = null;
|
private _latestValue: Object = null;
|
||||||
private _latestReturnedValue: Object = null;
|
private _latestReturnedValue: Object = null;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ export class AsyncPipe implements OnDestroy {
|
||||||
this._obj = null;
|
this._obj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateLatestValue(async: any, value: Object) {
|
private _updateLatestValue(async: any, value: Object): void {
|
||||||
if (async === this._obj) {
|
if (async === this._obj) {
|
||||||
this._latestValue = value;
|
this._latestValue = value;
|
||||||
this._ref.markForCheck();
|
this._ref.markForCheck();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
export declare const APP_BASE_HREF: InjectionToken<string>;
|
export declare const APP_BASE_HREF: InjectionToken<string>;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class AsyncPipe implements OnDestroy {
|
export declare class AsyncPipe implements OnDestroy, PipeTransform {
|
||||||
constructor(_ref: ChangeDetectorRef);
|
constructor(_ref: ChangeDetectorRef);
|
||||||
ngOnDestroy(): void;
|
ngOnDestroy(): void;
|
||||||
transform(obj: Observable<any> | Promise<any> | EventEmitter<any>): any;
|
transform(obj: Observable<any> | Promise<any> | EventEmitter<any>): any;
|
||||||
|
|
Loading…
Reference in New Issue