Creating a fully re-usable component for a screen


#1

I want to create a build status widget that teams can add to any page within their Ember app. The widget would call a shared API to pull back data about the build status of internal applications and present it on the screen.

So it needs to do data retrieval over an API, support long-polls, and contain display logic. What I can’t figure out is how to fully encapsulate this logic into something that the teams can bring in without violating the core opinionated pieces of Ember (models tied to URL’s, etc…)

How do you encapsulate and share a fully coherent set of code like this in Ember (HTMLbars template code, data retrieval code, formatting, action handling, etc…)


#2

I think this would be a good case for a “data loading component”. Check out this blog post: http://emberigniter.com/should-components-load-data/ by @emberigniter


#3

Agreed. If I am reading the RFC for routable components correctly, they will ahve async data loading support on their own (not sure I fully get the details) which seems to be ideally what i want here.

Just have to wait until those come out, but can use services injected into components for now. Thanks for the link to the article.