vendredi 6 mars 2015

Access constant in an Ember template

Not sure what the proper "Ember Way" is to do this.


I have the following template, where I want to have three task-item-list component instances, each for a different taskState value. Obviously, I would like to get rid of the magic numbers.



<h4>Tasks:</h4>

<div><h5>Backlog:</h5>
{{ task-item-list tasks=model taskState=101 }}
</div>

<div><h5>Working:</h5>
{{ task-item-list tasks=model taskState=202 }}
</div>

<div><h5>Done!</h5>
{{ task-item-list tasks=model taskState=303 }}
</div>


Thanks to this discussion I can define constants in my config/environment.js file and use them in models, test, etc., but not (as near as I can tell) in my templates.


Is there a way to use the constants, or is there a better way to do this? I can see subclassing the component, but I don't think that's a great solution.


Thanks!





Aucun commentaire:

Enregistrer un commentaire