Imagine we are in a situation where we need to connect a child component property to the component instance itself within a template:
<child-component parent="???"></child-component1>
Is there a solution for this without having to create a specific property on the parent component, like so:
public thisInstance: ParentComponent = this;
and then use it like this:
<child-component parent="thisInstance"></child-component1>
Any thoughts on how to achieve this?
UPDATE 1: I am searching for a method that allows us to definitively assign a parent to a child component. This means if the child has multiple parents of the same component type at different hierarchy levels, we can accurately specify which one to use.
UPDATE 2: I am seeking an approach that does not constrain the type of parent that can be used with the child component. Therefore, I am unsure whether injecting a parent into the child's constructor using a base class (implemented by the parent) as a token would be effective.