Understand Angular’s forRoot and forChild

Heloise Bahadiroglu
JavaScript in Plain English
4 min readSep 13, 2020

--

forRoot / forChild is a pattern for singleton services that most of us know from routing. Routing is actually the main use case for it and as it is not commonly used outside of it, I wouldn’t be surprised if most Angular developers haven’t given it a second thought. However, as the official Angular documentation puts it:

--

--

Freelance Software Engineer. I write about web and cloud technologies. AWS and Azure certified.