我在這方面掙扎在角2.我刷新網址,並希望等待一頁完成加載的URL。然後我想做某事。不幸的是,我沒有成功:如何等待URL重新加載角2應用程序
getLoginScreen() {
return this.http.get(myService.LOGIN_URL)
.flatMap(result => this.changeBrowserUrl())
.subscribe(result => //i want to do sth when the page is loaded//);
}
changeBrowserUrl(): Observable<any> {
return Observable.create(observer => {
window.location.href = myService.LOGIN_URL;
observer.next();
});
}
你是什麼意思等待的網址?網址或迴應?什麼事? – micronyks
「我想做什麼,當頁面加載」的問題是什麼? –
我在第一頁(我的默認應用程序頁面)。然後我重定向到另一個網址。我想等待該頁面加載。加載完成後,我想從該新的url地址獲取參數。 –