4
votes

I'm a newbie to Angular environment and recently, I've been struggling with the change detection strategy. According to many articles I've read, with OnPush strategy, a component tells Angular that you can skip change detection for me unless there's a change on my input bindings. Here comes my question: As the title says, would OnPush strategy be useless/wrong if a component has no input bindings?

1

1 Answers

6
votes

No, OnPush still makes sense.

With OnPush change detection also is automatically invoked if an event binding or an |asnyc pipe of the component receives an event.

OnPush also prevents, as you mentioned, change detection to be run automatically when it is run on parent components, which might be inefficient.