So lets say I have something like (in model):
export default DS.Model.extend({
...
status: attr('string'),
});
API returns following values for status
: pending
, delivered
, completed
. In the Ember app, if status
== delivered
. The value should instead be rendered as arrived
.
Which means, in the model, I have a CP:
refinedStatus: Ember.computed('status', {
get() {
if (this.get('status') == 'delivered') {
return 'arrived';
}
else {
return this.get('status');
}
}
}),
I also dont like the fact, that I need to create a new CP called refinedStatus
, which literally does the same thing, but only having one condition.
Is there a cleaner approach?
Aucun commentaire:
Enregistrer un commentaire