Thank you rapropos, that is indeed a beter solution.
I’ve already done it my own way and it’s working. But next time I’ll use an output binding instead of input binding with event names.
I might change this later on, but right now I’m more concerned with finishing a deadline.
If it works, it works.
I’ll refractor when there is more time for me.
I get the idea of component encapsulation. I just haven’t dived deep enough into component creation yet. This is one of the not so many times I thought it would be a good idea to create a component. Because it was used on several places within my app.
I think I should’ve made more components now that I think of it.
I wasn’t much aware of Output bindings until now. Or I haven’t fully comprehended them yet.
In any case, my usecase was that I was creating a modal with a hero transition animation that need to be reverted when the back button was pressed on specific pages. Each of these pages had their own transition effects.
I couldn’t quickly figure out how to do this with output bindings so I went with events.