lundi 27 juillet 2015

How do I display specific string instead of model value in template using Ember.js?

I have an Ember route displaying an array of records. The model includes status like so:

status: DS.attr('number'),

The value of status will be returned as either: -1, 0 or 1.

I have no problem displaying that value for each record in the template using handlebars: {{modelName.status}}. This way, the status for each record reflects as either: -1, 0, 1.

I would like to do the following:

If the value of status is -1 display the string "Error".
If the value of status is 0 display the string "Completed".
If the value of status is 1 display the string "Pending".

Is this possible?




Aucun commentaire:

Enregistrer un commentaire