Skip to content

Instantly share code, notes, and snippets.

@Restuta
Last active August 29, 2015 14:27
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 Restuta/c09ea9cf61f0359f6435 to your computer and use it in GitHub Desktop.
Save Restuta/c09ea9cf61f0359f6435 to your computer and use it in GitHub Desktop.
activate-deactivate for header
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