Reputation: 1053
I may be approaching this incorrectly but I want to pass an array object in a component and build a map off of the data. For example if I had a book with a set of chapters and lines. The data coming in is defined as an object in the following way:
{
book: blah,
chapter: 1,
verse: 3
}
I want to take that array and display it this way:
chapter
line1
line2
line3
Like I said maybe I'm approaching this wrong where the passed in object shouldn't be configured by the component before it's rendered but I have issues modifying the model within a promise to be rendered by the front end.
Is what I'm trying to do possible?
Upvotes: 0
Views: 26
Reputation: 12872
You have lots of choice available..
1) Inside model hook, if you use promise so make use of then method to decorate.
2) Use setupController hook in route to decorate to your format and set it in controller
3) Have computed property in Component to return your expected model which depends on model.
4) If you are using Ember-data, you can normalizeResponse to your required format.
Upvotes: 1