I have a component that takes some current fixture data from my controller like so
{{vertical-graph metrics=controller.total_sessions_comparison}}
The controller property looks like this
total_sessions_comparison: [
[
{
metricNumber: "26%",
metricText: "September",
metricStyle: "height: 26%"
},
{
metricNumber: "22%",
metricText: "October",
metricStyle: "height: 22%"
},
],
[
{
metricNumber: "74%",
metricText: "September",
metricStyle: "height: 74%"
},
{
metricNumber: "78%",
metricText: "October",
metricStyle: "height: 78%"
}
]
],
My model hook is loading data from a custom express api like this
return Ember.$.getJSON('http://ift.tt/1ciQhj3');
I can access the model data in the template just fine (these are all under index) but I'm having some problems understanding how to take the month names for instance in the controller property and instead of hard coding them use the ones being dynamically passed through the API. The model property looks like current_month
and last_month
which like I said work in the template but I can't get them to work in the controller.
Or is there maybe a better way of doing this than I currently am that would make this easier?
Aucun commentaire:
Enregistrer un commentaire