I'm facing an issue with this in Angular 2. When I refresh the URL, I need to wait for the page to finish loading before performing a certain action. However, I haven't been able to figure it out successfully:
fetchLoginPage() {
return this.http.get(myService.LOGIN_URL)
.flatMap(result => this.updateBrowserUrl())
.subscribe( result => //I need to do something once the page has finished loading//);
}
updateBrowserUrl(): Observable<any> {
return Observable.create( observer => {
window.location.href = myService.LOGIN_URL;
observer.next();
});
}