-
-
Save knownasilya/8c9f78d910ed50ec8d84 to your computer and use it in GitHub Desktop.
promiseproxy service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default Ember.Route.extend({ | |
model() { | |
return this.get('community'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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