Created
December 22, 2013 16:19
-
-
Save morsdyce/8084818 to your computer and use it in GitHub Desktop.
Wordpress style body classes in angular #angularjs #javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body ng-class="controller"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment