# Re-usable Components and Link Generation

**URL:** <https://discuss.emberjs.com/t/re-usable-components-and-link-generation/7892>\
**Category:** Uncategorized\
**Created:** [April 30, 2015, 3:24am UTC](https://discuss.emberjs.com/t/re-usable-components-and-link-generation/7892 "2015-04-30T03:24:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcherman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dcherman/32/10789_2.png) [@dcherman](https://discuss.emberjs.com/u/dcherman)\
**Post date:** [April 30, 2015, 3:24am UTC](https://discuss.emberjs.com/t/re-usable-components-and-link-generation/7892/1 "2015-04-30T03:24:16Z")

</div>

I’m trying to create a component that can be re-used in multiple applications across my company, however I’m having trouble figuring out how to handle link generation.

For the sake of this example, let’s say I have 2 applications - `Alpha` and `Bravo`. A standalone component of application `Alpha` may be used in either `Alpha` or `Bravo`. When the component generates anchors/links to resources in `Alpha`, it needs to be somehow aware of what application it’s currently in since in the `Alpha` case, the component should likely use the `linkTo` helper in order to transition state within the application. When the component is used in `Bravo`, it seems like an absolute URL would need to be generated since not only do I not have my route definitions included, the application is on an entirely different domain.

To complicate this a bit further, we have several different stages that an application can be deployed to ( i.e. devel, qa, production ). The link generation should be aware of the environment so that if `Bravo` is in devel or local development, then the links generated by the `Alpha` component should point to the development version of `Alpha`.

My initial thought on how to accomplish this is to create a service that you may configure during app bootstrapping and would provide link generation utilities, however that doesn’t help in the case where I feel like we should be using `link-to` ( `Alpha` Component in the `Alpha` Application ).

Has anyone else encountered similar scenarios, and how would you suggest tackling something like this?
