lundi 26 juin 2017

How can I get Ember Route variables in Handlebars

I've noticed something interesting today.

If I create a variable in my Controller

export default Ember.Controller.extend({
   controllerFoo: "Cut"
});

And I create a similar variable in my Route

export default Ember.Controller.extend({
    routeFoo: "Copy"
});

that when I print it in the .hbs:

controllerFoo:
<hr>
routeFoo: 

only the controllerFoo will display. I previously though Route and Controller variables could be used interchangeably. If I wanted to use a route variable, how could I do that? Or maybe is it bad practice?




Aucun commentaire:

Enregistrer un commentaire