I have a parent and a child component that need to interact. Normally I would use contextual components. I this case this does not work, as the two components are not on the same route template. The parent component is on one route and the child component is on the child route and as far as I know, I can't pass the contextual component to the .
Route | Component
----------------------------
route | parentComponent
route.sub | childComponent
I currently see two options:
- Move the parent component logic to the controller
- Use a service
I would like to avoid both options, as the same parent child components might be displayed twice at the same time. In both cases I don't see an other option as to use some kind of ID to connect the correct child with the correct parent and I don't like that, as I find it hard to debug and read.
Controller/Service
∧ |
| ∨
action() ? or ? -> use of ID
∧ | |
| ∨ ∨
child child parent parent
Is there an other way to do that? Thanks for the help!
Aucun commentaire:
Enregistrer un commentaire