Skip to content

Instantly share code, notes, and snippets.

@patrickberkeley
Created March 13, 2014 19:21
Show Gist options
  • Save patrickberkeley/9535024 to your computer and use it in GitHub Desktop.
Save patrickberkeley/9535024 to your computer and use it in GitHub Desktop.
Set the current path as a class on ember's application view.
App.ApplicationView = Ember.View.extend({
classNames: ['app'], // Static classes here.
classNameBindings: ['classForPath'], // Your dynamic path here.
classForPath: (function() {
var currentPath = this.get('controller.currentPath') || '';
currentPath = Ember.String.decamelize(currentPath);
currentPath = currentPath.split('.').join('-');
return currentPath;
}).property('controller.currentPath')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment