Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I load data in an ember view/template/component directly, not from a route #9

Open
ghost opened this issue Jul 22, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 22, 2015

I have a route:

/foo/1/foobar2

That loads data from a web service. In the template it loops through {{#each}} record and builds a up a display. Part of that display (a bootstrap tab) needs data from a different web service that wasn't loaded in the route. This web service needs a value from the {{#each}} record that's the foreign key to lookup and display a small set of related objects.

What's the correct ember mechanism for doing this?

@lukesargeant
Copy link

If you want to wrap the web service response in an Ember Data model, then you can inject the store into the component instead and just use it from your component.

If you aren't confident with Ember Data then you could create an ember 'service' that talks to the web service using standard AJAX requests. Then use an initializer to inject that service into the components that need it and just get the data when you init the component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant