Skip to content

Instantly share code, notes, and snippets.

@morsdyce
Created December 22, 2013 16:19
Show Gist options
  • Save morsdyce/8084818 to your computer and use it in GitHub Desktop.
Save morsdyce/8084818 to your computer and use it in GitHub Desktop.
Wordpress style body classes in angular #angularjs #javascript
app.run(function ($rootScope) {
$rootScope.$on('$routeChangeSuccess', function (e, data) {
if (data.$$route && data.$$route.controller) {
$rootScope.controller = data.$$route.controller.toLowerCase().replace('controller', '-controller');
}
})
});
<body ng-class="controller">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment