Skip to content

Commit 4707d56

Browse files
naaajiiAndrewKushnir
authored andcommitted
docs: update live demo for change detector (#50328)
fixes #44553 PR Close #50328
1 parent c69ef4e commit 4707d56

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/core/src/change_detection/change_detector_ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {ViewRef} from '../render3/view_ref';
3333
*
3434
* The following example sets the `OnPush` change-detection strategy for a component
3535
* (`CheckOnce`, rather than the default `CheckAlways`), then forces a second check
36-
* after an interval. See [live demo](https://plnkr.co/edit/GC512b?p=preview).
36+
* after an interval. See [live demo](https://stackblitz.com/edit/angular-myjuxd?file=src/main.ts).
3737
*
3838
* <code-example path="core/ts/change_detect/change-detection.ts"
3939
* region="mark-for-check"></code-example>

packages/examples/core/ts/change_detect/change-detection.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
/* tslint:disable:no-console */
9+
import {CommonModule} from '@angular/common';
910
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, NgModule} from '@angular/core';
1011
import {FormsModule} from '@angular/forms';
1112

@@ -15,6 +16,8 @@ import {FormsModule} from '@angular/forms';
1516
selector: 'app-root',
1617
template: `Number of ticks: {{numberOfTicks}}`,
1718
changeDetection: ChangeDetectionStrategy.OnPush,
19+
standalone: true,
20+
imports: [CommonModule]
1821
})
1922

2023
class AppComponent {
@@ -104,6 +107,6 @@ class App1 {
104107
// #enddocregion reattach
105108

106109

107-
@NgModule({declarations: [AppComponent, GiantList, App, LiveData, App1], imports: [FormsModule]})
110+
@NgModule({declarations: [GiantList, App, LiveData, App1], imports: [FormsModule, AppComponent]})
108111
class CoreExamplesModule {
109112
}

0 commit comments

Comments
 (0)