import {Component, Input, Output, EventEmitter, ViewChild, ElementRef} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {ActivatedRoute, Router} from '@angular/router'; import {Location} from '@angular/common'; import {ErrorCodes} from '../utils/properties/errorCodes'; import {RouterHelper} from '../utils/routerHelper.class'; import {Session} from '../login/utils/helper.class'; @Component({ selector: 'reload', template: `
Go to initial page....
` }) export class ReloadComponent { constructor (private element: ElementRef, private route: ActivatedRoute, private _router: Router, private location: Location ) { } public ngOnInit() { if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); } var URL = Session.getReloadUrl(); var url = URL["path"]; if(url && url != null && url != ""){ var host = URL["host"]; var paramsObject = Session.getParamsObj(URL["params"]); if(host == (location.protocol+"//"+location.host)){ if(paramsObject && paramsObject != null){ Session.setReloadUrl("","","") this._router.navigate([url],{ queryParams: paramsObject}); }else{ Session.setReloadUrl("","","") this._router.navigate([url]); } }else{ Session.setReloadUrl("","","") window.location.href = host+url+URL["params"]; } }else{ Session.setReloadUrl("","","") this._router.navigate(['/']); } } }