Ember Tether
![Ember Observer Score](http://emberobserver.com/badges/ember-tether.svg)
This ember-cli addon provides a component that allows for 'tethering' a block to a target somewhere else on the page. The target may be an element, an element selector, or an Ember view. Importantly, the component retains typical context for Ember action handling and data binding.
Example Usage
Given the following DOM:
<body class="ember-application">
<div id='a-nice-person'>
Nice person
</div>
<div class="ember-view">
</div>
</body>
and a template like this:
{{#ember-tether
target='#a-nice-person'
targetAttachment='top right'
attachment='top left'
}}
A puppy
{{/ember-tether}}
Then "A puppy" would be rendered alongside the a-nice-person
div.
If the ember-tether component is destroyed, its far-off content is destroyed too.
For example, given:
{{#if isShowing}}
{{#ember-tether
target='#a-nice-person'
targetAttachment='top right'
attachment='top left'
}}
A puppy
{{/ember-tether}}
{{/if}}
If isShowing
starts off true and becomes false, then the "A puppy" text will be removed from the page.
Similarly, if you use ember-tether
in a route's template, it will
render its content next to the target element when the route is entered
and remove it when the route is exited.
Tether Dependency Configuration
ember-tether depends on Hubspot Tether, which is imported as a bower dependency. When using ember-tether directly in an Ember app, everything will work out of the box with no configuration
necessary.
When using ember-tether nested within another addon, ember-tether cannot
import its dependencies. Include the following config in the addon's included
hook to tell ember-tether
exclude its dependency import:
included: function(app) {
app.options = app.options || {};
app.options.emberTether = app.options.emberTether || {};
app.options.emberTether.excludeDependencies = false;
}
Development Setup
Installation
git clone
this repositorynpm install
bower install
Running Tests
ember try:testall
ember test
ember test --server
Running the dummy app
For more information on using ember-cli, visit http://www.ember-cli.com/.
Credits
- Hubspot Tether, the underlying library that implement the actual tethering behavior
- ember-wormhole, whose pattern for element content manipulation inspired the approach in ember-tether
- Tetherball, for providing countless hours of entertainment over the past century