I have a model in a route that has data i'd like to chart using a chart plugin (ember-google-charts or ember-charts specifics do not matter to my issue)
in routes/server.js
:
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
return Ember.RSVP.hash({
stats: this.store.query('stat', {filter: {serverId: params.server_id}})
server: this.store.findRecord('server', params.server_id),
})
},
setupController(controller, models) {
controller.setProperties(models);
}
}
});
My issue where/how to make stats into a proper array (using timechecked and players attributes) in order to pass the data into a charting plugin in the template.
I've tried something similar to:
stats: this.store.query('stat', {filter: {serverId: params.server_id}}).then(items => {
//modify items here
})
but i have a hard time figuring out how to manipulate the data and build a new array without throwing errors using a forEach (which exists on the ember Array class)
Aucun commentaire:
Enregistrer un commentaire