title: AngularJS logout not working
body: <p>I have tried logout my current session. But logout not working. Check below my code:</p>
  
  <p><strong>view</strong></p>
  
  <pre><code>&lt;a ui-sref="logout"&gt;
     &lt;i class="fa fa-sign-out"&gt;&lt;/i&gt; Log out
  &lt;/a&gt;
  </code></pre>
  
  <p><strong>config.js</strong></p>
  
  <pre><code>$stateProvider
              .state('logout', {
                  url: "/logout",
                  templateUrl: '',
                  controller: "LogoutController"
              });
  </code></pre>
  
  <p><strong>controllers.js</strong></p>
  
  <pre><code>function LogoutController($location, $http) {
      alert("hi");
      //Session.clear();
      var request = $http({
          method: "post",
          url: "users/ajaxLogout",
          dataType: 'json',
          headers: {'Content-Type': 'application/x-www-form-urlencoded'}
      });
      request.success(function(data) {
  
      });
      $location.path('/login');
  }
  
  angular
     .module('inspinia')
     .controller('MainCtrl', MainCtrl)
     .controller('LogoutController', LogoutController);
  </code></pre>
  
  <p>I have alerted in <code>LogoutController</code> but that function not calling while I am clicking <code>Log out</code> link.</p>
  
  <p>I follow this link - <a href="https://stackoverflow.com/questions/19635407/angular-logout-redirect-route#answer-19640276">Angular - Logout redirect route</a> Please check and let me know where is error in my code.</p>