Javascript AngularJs:如何检查超链接是否已完全加载,然后执行下一个操作

Javascript AngularJs:如何检查超链接是否已完全加载,然后执行下一个操作,javascript,angularjs,Javascript,Angularjs,问题很简单,我只想检查超链接是否已在ng click事件中完全加载 HTML: <div ng-click='clicked()'>Click me</div> $scope.clicked= function() { window.location='https://firstlink.com'; // //when above wesbite page is fully loaded then go to below code and load the next l

问题很简单,我只想检查超链接是否已在ng click事件中完全加载

HTML:

<div ng-click='clicked()'>Click me</div>
$scope.clicked= function() {
window.location='https://firstlink.com';
//
//when above wesbite page is fully loaded then go to below code and load the next link
//
window.location='https://secondlink.com';
}
注意:

<div ng-click='clicked()'>Click me</div>
$scope.clicked= function() {
window.location='https://firstlink.com';
//
//when above wesbite page is fully loaded then go to below code and load the next link
//
window.location='https://secondlink.com';
}
我不想检查视图是否已加载,我想检查URL是否已完全加载。 我已经查阅了很多关于这方面的文章和帖子,但我得到的只是如何检查angularjs应用程序是否已加载。我想得到一种方法,我可以用它来检查这些URL是否已完全加载。 以下是我已经讨论过的一些问题:


使用
angular.element
等待页面加载

$scope.clicked= function() {
 window.location='https://firstlink.com';
 //
 //when above wesbite page is fully loaded then go to below code and load the next link
 //

 angular.element(function () {
    window.location='https://secondlink.com';

 });
}

我自己找到了一个解决方案:

通过使用间隔,我可以先加载第一页,然后等待它完全加载。下面是它的代码:

window.location='https://firstlink.com';
var interval = setInterval(function() {     
     if(document.readyState === 'complete') {
window.location='https://secondlink.com';
clearInterval(interval);

    }    
    }, 100); 

阅读更多有关此
文档的信息。readyState

您使用的是AngularJS v 1.6的哪个角度版本