Skip to content

Instantly share code, notes, and snippets.

@spiegela
Created May 27, 2014 23:51
Show Gist options
  • Select an option

  • Save spiegela/5d5bf3773d50d18776a7 to your computer and use it in GitHub Desktop.

Select an option

Save spiegela/5d5bf3773d50d18776a7 to your computer and use it in GitHub Desktop.
var NavigationController = Ember.ArrayController.extend({
content: Ember.A([
Ember.Object.create({title: "About", location: 'about', active: null}),
Ember.Object.create({title: "Projects", location: 'projects', active: null})
]),
title: "Almighty Machine",
activeLink: null,
activeLinkObserver: function() {
var activeLink = this.get('activeLink');
var content = this.get('model');
content.setEach('active', false);
if(typeof activeLink !== "undefined" && activeLink !== null) {
content.findBy('location', activeLink).set('active', true);
}
}.observes('activeLink')
});
export default NavigationController;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment