From 7a6358b4a89f179a667ae04998167dd729fa8d74 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Wed, 26 May 2021 16:03:23 -0700 Subject: [PATCH] docs: add note to clarify that ngOnChanges is only called if inputs are bound (#42374) fixes #23017 PR Close #42374 --- aio/content/guide/lifecycle-hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aio/content/guide/lifecycle-hooks.md b/aio/content/guide/lifecycle-hooks.md index c7058e8165..6cae1b0efb 100644 --- a/aio/content/guide/lifecycle-hooks.md +++ b/aio/content/guide/lifecycle-hooks.md @@ -60,7 +60,7 @@ Angular executes hook methods in the following sequence. You can use them to per - Called before `ngOnInit()` and whenever one or more data-bound input properties change. + Called before `ngOnInit()` (if the component has bound inputs) and whenever one or more data-bound input properties change. Note that if your component has no inputs or you use it without providing any inputs, the framework will not call `ngOnChanges()`. @@ -79,7 +79,7 @@ Angular executes hook methods in the following sequence. You can use them to per - Called once, after the first `ngOnChanges()`. + Called once, after the first `ngOnChanges()`. `ngOnInit()` is still called even when `ngOnChanges()` is not (which is the case when there are no template-bound inputs).