Pavel Franta
Pavel Franta

Reputation: 1313

EmberJS 3.15 - How to pass data from child to parent

what is the correct approach to pass data from child component to parent?

( for example, you have a simple input-like component. You can pass data into the component from parents easily. User will change an input value and now you need to pass data from the component to its parent for some reasons )

how you can pass data from child to parent ? Thank you

Upvotes: 2

Views: 1495

Answers (1)

Pavel Franta
Pavel Franta

Reputation: 1313

The correct way is probably:

  1. declare method in parent ( decorated with @action or can be task ).
  2. pass this method to component as usual
  3. call this function from child
  4. method will be invoked with parent context

Upvotes: 5

Related Questions