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+'';

}

1
  • you can use JS function setTimeout for the same Commented Jan 27, 2017 at 9:35

1 Answer 1

0

Inject $timeout in your controller and write something like

$timeout(function() {
   $window.location.href = 'http://localhost:8099/medical-web/login?essionid='+sessionid+'';
}, 3000);
Sign up to request clarification or add additional context in comments.

2 Comments

@Prashanth if so, please accept the answer
@Prashanth just click the check below an answer to accept it

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.