Last active
August 29, 2015 14:27
-
-
Save Restuta/c09ea9cf61f0359f6435 to your computer and use it in GitHub Desktop.
activate-deactivate for header
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
activate() { | |
//read model for application header | |
var appModel = this.modelFor(`application`); | |
//get current header that is rendered before we enter current route | |
var currentHeader = appModel.get(`currentHeader`); | |
//save that header to our current route | |
this.set(`prevHeader`) = currentHeader; | |
//set current app header to one that is defined in current route | |
appModel.set(‘currentHeader’) = this.get(`header`); | |
this._super(…arguments); | |
} | |
deactivate() { | |
//read model for application header | |
var appModel = this.modelFor(`application`); | |
//restore old header before we exit | |
appModel.set(`currentHeader`, this.set(`prevHeader`)); | |
this._super(…arguments); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment