parent
489fec1299
commit
5412e10bcd
|
@ -15,15 +15,15 @@ export abstract class ChangeDetectorRef {
|
||||||
*
|
*
|
||||||
* <!-- TODO: Add a link to a chapter on OnPush components -->
|
* <!-- TODO: Add a link to a chapter on OnPush components -->
|
||||||
*
|
*
|
||||||
* ### Example ([live demo](http://plnkr.co/edit/GC512b?p=preview))
|
* ### Example ([live demo](https://stackblitz.com/edit/angular-kx7rrw))
|
||||||
*
|
*
|
||||||
* ```typescript
|
* ```typescript
|
||||||
* @Component({
|
* @Component({
|
||||||
* selector: 'cmp',
|
* selector: 'my-app',
|
||||||
* changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
* template: `Number of ticks: {{numberOfTicks}}`
|
* template: `Number of ticks: {{numberOfTicks}}`
|
||||||
|
* changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
* })
|
* })
|
||||||
* class Cmp {
|
* class AppComponent {
|
||||||
* numberOfTicks = 0;
|
* numberOfTicks = 0;
|
||||||
*
|
*
|
||||||
* constructor(private ref: ChangeDetectorRef) {
|
* constructor(private ref: ChangeDetectorRef) {
|
||||||
|
@ -34,16 +34,6 @@ export abstract class ChangeDetectorRef {
|
||||||
* }, 1000);
|
* }, 1000);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
|
||||||
* @Component({
|
|
||||||
* selector: 'app',
|
|
||||||
* changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
* template: `
|
|
||||||
* <cmp><cmp>
|
|
||||||
* `,
|
|
||||||
* })
|
|
||||||
* class App {
|
|
||||||
* }
|
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
abstract markForCheck(): void;
|
abstract markForCheck(): void;
|
||||||
|
@ -136,12 +126,9 @@ export abstract class ChangeDetectorRef {
|
||||||
/**
|
/**
|
||||||
* Reattach the change detector to the change detector tree.
|
* Reattach the change detector to the change detector tree.
|
||||||
*
|
*
|
||||||
* This also marks OnPush ancestors as to be checked. This reattached change detector will be
|
|
||||||
* checked during the next change detection run.
|
|
||||||
*
|
|
||||||
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
|
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
|
||||||
*
|
*
|
||||||
* ### Example ([live demo](http://plnkr.co/edit/aUhZha?p=preview))
|
* ### Example ([live demo](https://stackblitz.com/edit/angular-ymgsxw))
|
||||||
*
|
*
|
||||||
* The following example creates a component displaying `live` data. The component will detach
|
* The following example creates a component displaying `live` data. The component will detach
|
||||||
* its change detector from the main change detector tree when the component's live property
|
* its change detector from the main change detector tree when the component's live property
|
||||||
|
@ -176,14 +163,14 @@ export abstract class ChangeDetectorRef {
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @Component({
|
* @Component({
|
||||||
* selector: 'app',
|
* selector: 'my-app',
|
||||||
* providers: [DataProvider],
|
* providers: [DataProvider],
|
||||||
* template: `
|
* template: `
|
||||||
* Live Update: <input type="checkbox" [(ngModel)]="live">
|
* Live Update: <input type="checkbox" [(ngModel)]="live">
|
||||||
* <live-data [live]="live"><live-data>
|
* <live-data [live]="live"><live-data>
|
||||||
* `,
|
* `,
|
||||||
* })
|
* })
|
||||||
* class App {
|
* class AppComponent {
|
||||||
* live = true;
|
* live = true;
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
|
|
Loading…
Reference in New Issue