Adding route specific body class tags in Ember

By: Brian Cardarella

Our designer likes to use body class tags depending upon the context of the app he is designing. We’re currently building an Ember app and this is how I got it working:

  activate: function() {
    var cssClass = this.toCssClass();
    // you probably don't need the application class
    // to be added to the body
    if (cssClass != 'application') {
  deactivate: function() {
  toCssClass: function() {
    return this.routeName.replace(/\./g, '-').dasherize();