dimanche 27 novembre 2022

How to access child component from parent component in Ember

The concept is fairly simple.

Assume I have a child component with its own separate js and hbs. Child-component.hbs =>

<Button options =  selected=
> Submit <Button

Child-component.js

listOptions =[{id: 124, name: 'Mywork'} selected => performing an action after getting the value from hbs selection.

Now I'm importing this into another component Main-component.hbs like this

<ChildComponent />

This is rendering as expected with options and all, but based on the selectedOption I want to do something in my main component. Handling the action in the Main-component is not an option for me as its not what I was told to do. Is it possible to access selectedOption from the main-component? Kindly help.

Please note that I want to achieve this in Octane version.




Aucun commentaire:

Enregistrer un commentaire