title: AngularJS - "$digest already in progress" after logout
body: <p>I want to redirect to the main page after the user is logged out </p>
  
  <pre><code>$rootScope.logOut = function () {
     myService.logOut().then(function (data) {
        $rootScope.$apply(function () {
           $location.path("/");
        });
     });
  }
  </code></pre>
  
  <p>but it generates </p>
  
  <blockquote>
    <p>$digest already in progress</p>
  </blockquote>
  
  <p>error. How to fix it ?</p>