If you are working especially with very big projects, the strategy is recommended to decrease the change detection process that it is a very expensive operation.OnPush
There are many ways of starting the detection when needed, maybe the most used is to trigger manually from the changeDetection().ChangeDetectorRef
If you have an inherited project and you want to use the strategy, the recommendation is to start applying it from the leaf components, check that everything is still working, and then follow the ancestors and go up one level at time to the root. In the end the overall performance is going to benefit.OnPush
Here there is a very good article about change detection in Angular.
If you want your new generated components to have automatically the strategy added, you just need to add the option in your OnPush at the angular.json node, for example:schematics
...
"schematics": {
"@schematics/angular:component": {
"changeDetection": "OnPush",
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
...
I found a workaround to this problem although I am not sure if this is the ideal solution.
We can listen to the form group value changes and then trigger change detection in the input component
this.form.valueChanges.subscribe( () => {
this.cdr.detectChanges()
});
This way it updates the label values as well along with the inputs.

Here is the solution:
https://stackblitz.com/edit/angular-change-detection-form-group-value-change-issue-resolved
I'm not sure if it's a bug from Angular but happy that I figured out some workaround :)
By default, the Change Detection is run when the object reference is updated which is why it is said that change detection is run only on immutable objects.
You have to use change detection strategy when you component solely relies on the OnPush bindings to it.Input()
You have to run the method on the markForChange() inside the ChangeDetectorRef in the child component.ngDoCheck()
Use this link from medium to further understand my answer.
I have created a project and uploaded it on GitHub for the scenario you mentioned. You may use it for your reference.
Input works fine. Subscription in with ngOnInit doesn't run change detection. You need to do one of following:OnPush
async pipe instead of .subscribe() (async pipe runs markForCheck)OnPush strategySo, the comments are totally right. will cause it to go up to the root, but that's not a bad thing.. markForCheck()
If your app goes: and you make changes on your root > section > page > area > row > list then you would want to notify the parent items that changes have happened. Maybe you need to grow bigger now that more data is loaded, or trigger a scroll, or all sorts of stuff.list
Remember though that you'll have to wait for a tick and if you're using on the parents as well without being notified that a child has changed with onPush() the detection will never reach your child, that's why it goes all the way. markForCheck()
The other method is manually triggering with This will run only on the local component and treats the node that called detectChanges() as the root..detectChanges()
Also, if you're displaying any property of your component it isn't technically Private. Javascript will allow it of course but test suites and I think even the compiler will complain. if you for whatever MUST do it, display it with a public getter.. like this:
Private _mySuperSecret: 'I am Batman';
Public get mySecret() { return this._mySuperSecret; };
According to this GitHub issue, most Kendo UI components use the default change detection strategy, but there are some exceptions: Charts, Date Inputs, Scheduler, TreeList and some internal components use .ChangeDetectionStrategy.OnPush
Hi guys I tried all your answers and even settimeout is not working for me. I also dont prefer using settimeout as it does change detection from app component level
This worked for me :). I really cant understand why detectChanges is working for all the rest and only for this p-chips I need to add markForCheck before it to work.
this._cdRef.markForCheck();
this._cdRef.detectChanges();