I'm trying to implement this behavior using AngularJS components.
<parent-component>
<reusable-child-component></reusable-child-component>
</parent-component>
What I want is to pass the parent's controller to the a reusable child component. I know that passing controllers can be done using require attribute but will include the name of the parent's component. (ex. require : '^parentComponent').
Is it possible for me to pass dynamic controller to the child component? That the child component will dynamically receive whatever its parent controller.
<parent-component>
<reusable-child-component></reusable-child-component>
</parent-component>
<parent2-component>
<reusable-child-component></reusable-child-component>
</parent2-component>
Need suggestions or help. If possible, written in typescript.