Still fairly new to ember.js
, so I was wondering if, in my model, if I have an attribute that is a number, like so:
export default Model.extend({
numberOfThings: attr('number')
});
And I have a handlebars template like this:
<div class="stuff">
<div class="row">
<div class="column">
</div>
</div>
</div>
Then how can I sort by the size of numberOfThings
using a controller?
I've tried the following:
import Ember from 'ember';
const { computed } = Ember;
export default Ember.Controller.extend({
sortingAttr: ['number_of_things'], // from the model in the Rails API
sortedStuff: computed.sort('model', 'sortingAttr'),
});
However, this doesn't seem to work, as the order of the objects in the HTML doesn't change.
Might this be specific to the application I'm working with? (didn't start from scratch)
Or am I doing something wrong syntactically?
Aucun commentaire:
Enregistrer un commentaire