Angular · Middle · Question 34 of 75
Why does a component not re-run ngOnInit when navigating from /users/1 to /users/2?
- ✓Correct answer: The router reuses the same component instance when only parameters change
- 2
ngOnInitis only called in production mode - 3The router caches the whole page
Explanation
Read the param reactively: an input with withComponentInputBinding, or route.paramMap combined with switchMap. Reading the snapshot once in ngOnInit shows stale data.