Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kellyselden/ember-resolve-promise-helper
Resolve a promise when it is a trailing property
https://github.com/kellyselden/ember-resolve-promise-helper
Last synced: 16 days ago
JSON representation
Resolve a promise when it is a trailing property
- Host: GitHub
- URL: https://github.com/kellyselden/ember-resolve-promise-helper
- Owner: kellyselden
- License: mit
- Created: 2015-12-29T03:20:17.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-11T04:01:02.000Z (about 9 years ago)
- Last Synced: 2025-01-02T05:43:49.823Z (24 days ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-resolve-promise-helper
[![Build Status](https://travis-ci.org/kellyselden/ember-resolve-promise-helper.svg)](https://travis-ci.org/kellyselden/ember-resolve-promise-helper)
[![npm version](https://badge.fury.io/js/ember-resolve-promise-helper.svg)](https://badge.fury.io/js/ember-resolve-promise-helper)Resolve a promise when it is a trailing property
```js
// models/parent.js
export default DS.Model.extend({
child: DS.belongsTo('child');
});
``````js
// models/child.js
export default DS.Model.extend({
name: DS.attr();
});
``````js
// routes/application.js
export default Ember.Route.extend({
model() {
return this.store.findRecord('parent', 1);
}
});
``````hbs
{{!-- templates/application.hbs --}}
{{my-component child=(resolve-promise model.child)}}
``````js
// components/my-component.js
export default Ember.Component.extend({
// This would not work otherwise
name: Ember.computed.reads('child.name')
});
```## Installation
* `git clone` this repository
* `npm install`
* `bower install`## Running
* `ember server`
* Visit your app at http://localhost:4200.## Running Tests
* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions)
* `ember test`
* `ember test --server`## Building
* `ember build`
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).