How to make ember component fetch data from server. put AJAX call inside the component seems not a good practise to handle this

Personally I would like to see more separation in the components so they are data and context unaware. Currently I don’t feel like that is always possible as data down isn’t always a plausible solution. Many times you need to take actions when no observable data has happened. In my other discussion, I would love to have data handled on the route, but it isn’t possible because sometimes data isn’t passed down as a result of an action being called. Also in the other discussion, there are times when a component (our Stripe component) needs to have actions taken that aren’t data dependent at all.

With that said, I love the idea of having components that are context and data unaware, that can be shared and reused on any app, but with the Ember 2.0 changes coming and everything becoming a component, I don’t see how that will be possible anymore with a “data down actions up” only approach. Either callbacks will need to be passed in with the actions for things that don’t require data or could have no updated data, or ember is going to need to update its approach to communicating with components and their children when it’s not data bound.

1 Like