Last active
January 5, 2016 19:39
-
-
Save brenna/238be391fd62cc1023d1 to your computer and use it in GitHub Desktop.
Ember router 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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
router: Ember.inject.service() | |
// ...component stuff that uses transitionTo | |
}); |
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
//polyfill an injectable router with a custom service | |
import Ember from 'ember'; | |
export default Ember.Service.extend({ | |
emberRouter: null, | |
stealRouter: Ember.on('init', function() { | |
const router = this.container.lookup('router:main'); | |
this.set('emberRouter', router); | |
}), | |
transitionTo(...args) { | |
this.get('emberRouter').transitionTo(...args); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment