Why am i able to inject a parent component in a child component. Isn't DI just for services?

I am able to inject the parent component in a child component but isn’t DI just meant for injecting services? Why is this allowed and what are the possible classes which i can inject in a component?

I have seen at places we can inject component in a directive. This confuses me alot.

Can someone please put some light on this?

1 Like

Components and directives define element injectors, where instances of these are provided, read more in A curious case of the @Host decorator and Element Injectors in Angular

1 Like

Max is right.

We can inject directives and components that are ancestors in the active component tree. If we want to access descendant directives and components, we will use ViewChild, ViewChildren, ContentChild or ContentChildren.