parent
489fec1299
commit
5412e10bcd
|
@ -15,15 +15,15 @@ export abstract class ChangeDetectorRef {
|
|||
*
|
||||
* <!-- 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
|
||||
* @Component({
|
||||
* selector: 'cmp',
|
||||
* changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
* selector: 'my-app',
|
||||
* template: `Number of ticks: {{numberOfTicks}}`
|
||||
* changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
* })
|
||||
* class Cmp {
|
||||
* class AppComponent {
|
||||
* numberOfTicks = 0;
|
||||
*
|
||||
* constructor(private ref: ChangeDetectorRef) {
|
||||
|
@ -34,16 +34,6 @@ export abstract class ChangeDetectorRef {
|
|||
* }, 1000);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'app',
|
||||
* changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
* template: `
|
||||
* <cmp><cmp>
|
||||
* `,
|
||||
* })
|
||||
* class App {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
abstract markForCheck(): void;
|
||||
|
@ -136,12 +126,9 @@ export abstract class ChangeDetectorRef {
|
|||
/**
|
||||
* 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 -->
|
||||
*
|
||||
* ### 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
|
||||
* its change detector from the main change detector tree when the component's live property
|
||||
|
@ -176,14 +163,14 @@ export abstract class ChangeDetectorRef {
|
|||
* }
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'app',
|
||||
* selector: 'my-app',
|
||||
* providers: [DataProvider],
|
||||
* template: `
|
||||
* Live Update: <input type="checkbox" [(ngModel)]="live">
|
||||
* <live-data [live]="live"><live-data>
|
||||
* `,
|
||||
* })
|
||||
* class App {
|
||||
* class AppComponent {
|
||||
* live = true;
|
||||
* }
|
||||
* ```
|
||||
|
|
Loading…
Reference in New Issue