In previous section you have learned about ChangeDetectionStrategy using both default and OnPush options.
Some of the advantages of using OnPush option over default are given:
- It helps in increasing the performance of our Angular applications.
- Angular doesn't have to traverse the entire component tree structure for detecting individual changes on properties.
- Angular internally can skip the nested tree structures when inputted properties don't change.
To understand it better, let's create a use case. For that first we need to create a new component named change-detect using Angular CLI ng command.
Once the component is created, you should see the output as shown in the following screenshot: ...