Skip to content

Instantly share code, notes, and snippets.

@knownasilya
Forked from anonymous/community.js
Last active March 9, 2016 20:25
Show Gist options
  • Save knownasilya/8c9f78d910ed50ec8d84 to your computer and use it in GitHub Desktop.
Save knownasilya/8c9f78d910ed50ec8d84 to your computer and use it in GitHub Desktop.
promiseproxy service
export default Ember.Route.extend({
model() {
return this.get('community');
}
});
export function initialize(container, application) {
application.inject('controller', 'community', 'service:community');
application.inject('route', 'community', 'service:community');
application.inject('model', 'community', 'service:community');
application.inject('component', 'community', 'service:community');
}
export default {
name: 'community',
after: 'store',
initialize: initialize
};
import Ember from 'ember';
const { computed, inject, ObjectProxy, PromiseProxyMixin } = Ember;
export default ObjectProxy.extend(PromiseProxyMixin, {
isServiceFactory: true,
store: inject.service(),
promise: computed({
get() {
var store = this.get('store');
return store.findRecord('community', window.community.id);
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment