title: angular $timeout after refresh
body: <p>Iam having problems with angular $timeout. It works ok If I wont hit F5/reload page. When I reload the page the timeout stops and never calls the function I provided in timeout. I feel like the code is good but Iam missing something. Why the timeout is never hit when I refresh the page?</p>
  
  <pre><code>export class AccountController
  {
  
      constructor(private $scope: ControllerScope, private $location: ng.ILocationService, private AuthService: AuthService, private $timeout: ng.ITimeoutService)
      {
  
      }
  
      public Login(model: LoginModel)
      {
          this.AuthService.login(model).then((response: any) =&gt;
          {
              //when token will expire -&gt; logout
              this.$timeout(() =&gt;
              {
                  this.Logout();
              }, &lt;number&gt;response.TokenExpireTime).then((d) =&gt;
              {
                  alert('Czas trwania sesji wygasł');
              });
  
              this.$location.path('/');
          },
          (err) =&gt;
          {
              alert(err.error_description);
          });
  
      }
  
      public Logout()
      {
              this.AuthService.logOut();
              this.$location.path("/login");
      }
  
  }
  </code></pre>