DEV Community

Discussion on: Complex and Dynamic Form Design in Angular (Part 1 - Form Group)

Collapse
 
anduser96 profile image
Andrei Gatej

I’ve explored a little bit the repo and I’m wondering what’s the use case for the @Host decorator?(I’m referring to this article).
I’ve read a little bit about it but I can’t really understand why you decided to use it.

Could you please elaborate on that?

Thank you!

Thread Thread
 
imben1109 profile image
Ben • Edited

You could refer to the below link for detail.
medium.com/frontend-coach/self-or-...

@host is a decorator for DI Framework in angular to guide angular component to search for expected instance to inject.

If the expected instance cannot be found in the component, it would try to find from the parent component.