title: Can not add or remove body class when using $stateChangeSuccess event from UI-Router
body: <p>This is the issue took me about one week to troubleshooting!!! I can not find the answer. So I will share with you guys.</p>
  
  <p>Below is the code. The class <code>test</code> will apply to body without any issue if I click Login in /home state.</p>
  
  <p>BUT. If I paste <a href="http://localhost:3000/login" rel="nofollow">http://localhost:3000/login</a> into browser, it doesn't work at all!</p>
  
  <pre><code>angular.module('app').config(function($stateProvider) {
  
  $stateProvider
    .state('home', {
      url: '/home'
    }).state('login', {
      url: '/login'
    });
  
  }).run(function($rootScope) {
  
    $rootScope.$on('$stateChangeSuccess', function () {
      var bodyElem = angular.element(document.body);
      bodyElem.addClass('test');
    });
  
  });
  </code></pre>