Created
April 2, 2016 13:47
-
-
Save jonpitch/b13f2fced63afcaefe1cc52ba6a0802d to your computer and use it in GitHub Desktop.
Ember Theming - Route Example
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.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