async-container
![Ember badge](http://embadge.io/v1/badge.svg?start=1.13.0)
This addon enables a declarative way to react to actions which return a promise. When dealing with actions, it's common to represent the UI state while an async action is resolving. For example, a save button that needs to be disabled while a save request is in flight.
Example Usage
{{!-- templates/example.hbs --}}
{{#async-container (action 'save') as |async|}}
<button {{action async.invoke}} disabled={{async.inFlight}}>
{{#if async.inFlight}}
Saving
{{else}}
Save
{{/if}}
</button>
{{/async-container}}
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
save() {
return this.get('model').save();
}
}
});
Installation
ember install async-container
Running
Running Tests
npm test
(Runs ember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
Building
For more information on using ember-cli, visit http://www.ember-cli.com/.