0

I mm new to AngularJS. I have the following AngularJS code. I want to add some delay before my redirection code. Any help would be appreciated.

if(data.status=='success')
{  
      $scope.succ = "success";
      var sessionid=data.doctor.doctor_id;


     /*------------------------------------*/
     /* How to add delay (3 seconds) here */
     /*------------------------------------*/

  $window.location.href = 'http://localhost:8099/medical-web/login?essionid='+sessionid+'';

}

danday74
  • 52,471
  • 49
  • 232
  • 283
Prashanth RH
  • 43
  • 1
  • 1
  • 2

1 Answers1

0

Inject $timeout in your controller and write something like

$timeout(function() {
   $window.location.href = 'http://localhost:8099/medical-web/login?essionid='+sessionid+'';
}, 3000);
Dario
  • 6,152
  • 9
  • 39
  • 50