vendredi 27 février 2015

Ember communicate between view components and controllers

I have a dashboard and inside it some buttons for filter to posts.


This dashboard appear in all pages, so I a create a view dashboard with a template of same name.


to trigger filter, I have created an view filter-button:



export default Ember.View.extend(Ember.TargetActionSupport, {
tagName: 'button',
click(event) {
this._toggleComponentState();
this._dispatchAction();
},
_dispatchAction() {
this.triggerAction({
action: "filter",
target: this.get('controller'),
actionContext: this.get('context')
});
},
_toggleComponentState() {
this.$().toggleClass('active');
}
});


this action filter this sent to application controller, but I need send to an specific controller posts.index, hierarchically posts and dashboard have no connection. how can I create a communication correctly between my components?





Aucun commentaire:

Enregistrer un commentaire