Skip to content

Instantly share code, notes, and snippets.

@abuiles
Created August 22, 2016 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abuiles/ec8d2ab97b0e79aa1f62da8d2d2a8ad7 to your computer and use it in GitHub Desktop.
Save abuiles/ec8d2ab97b0e79aa1f62da8d2d2a8ad7 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Route.extend({
plugins: Ember.inject.service(),
model(params) {
/*
I'm assuming the plugin service have a method called mount
which "mounts" a plugin. This method returns a promise... Ember
won't move out of the model hook.
*/
return return this.get('plugins').mount('search').then((plugin) => {
return plugin.search(params.query);
});
},
deactivate() {
return this.get('plugins').unmount('search');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment