mercredi 19 avril 2017

Ember JS - Passing data between components

Using Ember JS 2.12.0

I have created a component that runs an action on click and receives some data. I now need to pass this data into another component. How would I go about this? The docs do not seem to cover it.

Here is my component template:

<div class="play-button" > 
  <span class="glyphicon glyphicon-play" aria-hidden="true"></span>
</div>

And the component JS:

import Ember from 'ember';
export default Ember.Component.extend({

    actions: {
        playTrack(track){
            console.log(track);
        }
    }

});

How can I pass the track object into another component?




Aucun commentaire:

Enregistrer un commentaire