vendredi 20 mai 2016

Actions in Ember 2.5--route or controller?

I've been anticipating the end of controllers when routable components are coming in the future. So I've been putting my action handlers in my routes.

// app/something/route.js
actions: {
    doSomething() {
         alert('action handled in route');
    }
}

In my template:




In my component:


<button >Click Me</button>

// app/components/some-component/component.js
actions: {
    onClickButton() {
       this.sendAction();
    }
}

Should I be handling actions in the route and avoiding controllers completely?




Aucun commentaire:

Enregistrer un commentaire