What is the context of an if-statement in a template or a component?
{{#if showBackButton}}
<div>....</div>
{{/if}}
How/where to define the showBackButton? I tried it in the application controller but it didn't find it.
Details
I have a header component called eea-header.hbs. It is inluded in the application.hbs to be shown on top of the page for all pages (routes) the application may have. But I have some conditional statement in the header to turn off/on different parts of the header. Ideally I want to define properties like showBackButton in each route, because teh route knows when each property shall be true/false.
Shall I put this in the route or the controller? Syntax? I have tried:
showBackButton: true,
and
showBackButton: Ember.computed(function() {
return true;
}),
and
showBackButton() {
return true;
}),
without luck. If the answer is the controller, can all templates access such properties in the application controller or do I have to define them in each controller.
I want to be ember 2.0 compatible.
Apologies for this basic question, but I have read the ember documentation and it doesn't address this basic question.
Aucun commentaire:
Enregistrer un commentaire