Skip to content

Instantly share code, notes, and snippets.

@jonpitch
Created April 2, 2016 13:47
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 jonpitch/b13f2fced63afcaefe1cc52ba6a0802d to your computer and use it in GitHub Desktop.
Save jonpitch/b13f2fced63afcaefe1cc52ba6a0802d to your computer and use it in GitHub Desktop.
Ember Theming - Route Example
import Ember from 'ember';
export default Ember.Route.extend({
theme: Ember.inject.service(),
// set theme to "second" when hitting route
beforeModel: function() {
this._super(...arguments);
this.get('theme').setTheme('second');
},
actions: {
// set theme to "first" when leaving route
willTransition: function() {
this.get('theme').setTheme('first');
this._super(...arguments);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment