docs(core): correct code examples for ChangeDetectorRef

This commit is contained in:
Daniel Kucal 2017-08-13 16:52:44 +02:00 committed by Hans Larsen
parent a618d6e4ce
commit 259fc91305
No known key found for this signature in database
GPG Key ID: 537DD9CDA3032687

View File

@ -28,7 +28,7 @@ export abstract class ChangeDetectorRef {
* *
* constructor(private ref: ChangeDetectorRef) { * constructor(private ref: ChangeDetectorRef) {
* setInterval(() => { * setInterval(() => {
* this.numberOfTicks ++ * this.numberOfTicks++;
* // the following is required, otherwise the view will not be updated * // the following is required, otherwise the view will not be updated
* this.ref.markForCheck(); * this.ref.markForCheck();
* }, 1000); * }, 1000);
@ -78,7 +78,7 @@ export abstract class ChangeDetectorRef {
* @Component({ * @Component({
* selector: 'giant-list', * selector: 'giant-list',
* template: ` * template: `
* <li *ngFor="let d of dataProvider.data">Data {{d}}</lig> * <li *ngFor="let d of dataProvider.data">Data {{d}}</li>
* `, * `,
* }) * })
* class GiantList { * class GiantList {
@ -169,12 +169,13 @@ export abstract class ChangeDetectorRef {
* constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {} * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {}
* *
* set live(value) { * set live(value) {
* if (value) * if (value) {
* this.ref.reattach(); * this.ref.reattach();
* else * } else {
* this.ref.detach(); * this.ref.detach();
* } * }
* } * }
* }
* *
* @Component({ * @Component({
* selector: 'app', * selector: 'app',