Reputation: 2965
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.Route.extend({
routeFoo: "Copy"
});
that when I print it in the .hbs:
controllerFoo:{{controllerFoo}}
<hr>
routeFoo: {{routeFoo}}
only the controllerFoo will display. I thought that 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?
Upvotes: 2
Views: 448
Reputation: 12872
Template context is controller, so mostly state will be maintained by the controller. If in case you need to pass some property from route to template then you need to use model
hook of the Route or use setupController
hook of the Route and set the required properties in controller.
Upvotes: 3