docs(PipeTransform): added pure parameter

closes #4667

The documentation was outdated since alpha 38 when the `pure` parameter
was added to the `PipeMetadata`.
This commit is contained in:
Olivier Combe 2015-10-11 17:18:30 +02:00 committed by Victor Berchet
parent 540b8c2a1a
commit 7478105178
1 changed files with 4 additions and 3 deletions

View File

@ -33,14 +33,15 @@
export interface PipeTransform { transform(value: any, args: any[]): any; } export interface PipeTransform { transform(value: any, args: any[]): any; }
/** /**
* To create a stateful Pipe, you should implement this interface. * To create a stateful Pipe, you should implement this interface and set the `pure`
* parameter to `false` in the {@link PipeMetadata}.
* *
* A stateful pipe may produce different output, given the same input. It is * A stateful pipe may produce different output, given the same input. It is
* likely that a stateful pipe may contain state that should be cleaned up when * likely that a stateful pipe may contain state that should be cleaned up when
* a binding is destroyed. For example, a subscription to a stream of data may need to * a binding is destroyed. For example, a subscription to a stream of data may need to
* be disposed, or an interval may need to be cleared. * be disposed, or an interval may need to be cleared.
* *
* ### Example ([live demo](http://plnkr.co/edit/hlaejwQAmWayxwc5YXQE?p=preview)) * ### Example ([live demo](http://plnkr.co/edit/i8pm5brO4sPaLxBx56MR?p=preview))
* *
* In this example, a pipe is created to countdown its input value, updating it every * In this example, a pipe is created to countdown its input value, updating it every
* 50ms. Because it maintains an internal interval, it automatically clears * 50ms. Because it maintains an internal interval, it automatically clears
@ -48,7 +49,7 @@ export interface PipeTransform { transform(value: any, args: any[]): any; }
* *
* ``` * ```
* import {Pipe, PipeTransform} from 'angular2/angular2' * import {Pipe, PipeTransform} from 'angular2/angular2'
* @Pipe({name: 'countdown'}) * @Pipe({name: 'countdown', pure: false})
* class CountDown implements PipeTransform, PipeOnDestroy { * class CountDown implements PipeTransform, PipeOnDestroy {
* remainingTime:Number; * remainingTime:Number;
* interval:SetInterval; * interval:SetInterval;