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
  • 45,909
  • 39
  • 198
  • 245
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
  • 5,898
  • 8
  • 35
  • 47