我在 ts 文件中有多个功能,如下所示。
reply_click(event) {
var target = event.target || event.srcElement || event.currentTarget;
var idAttr = target.attributes.id;
sessionStorage.setItem('geo', idAttr.nodeValue);
var value = sessionStorage.getItem('geo');
var NT = sessionStorage.getItem('NTsession');
var sesssion = sessionStorage.getItem('EmployeeDetail');
var ses = JSON.parse(sesssion);
var intEmPKNo = ses[0].EmPKNo;
var GeoList = ses[0].GeoList.substring(0, 3);
if (GeoList != value)
this.router.navigateByUrl('/notAuthorized');
else {
this._userService.get(Global.BASE_USER_ENDPOINT + '/EmployeeInfo?intEmPKNo=' + intEmPKNo)
.do(data => sessionStorage.setItem('EmployeeInfo', JSON.stringify(data)))
.subscribe(dashboard => {
this.dashboard = dashboard; this.indLoading = false;
this.attendance();
},
error => this.msg = <any>error);
}
}
attendance() {
var NT = sessionStorage.getItem('NTsession');
var sesssion = sessionStorage.getItem('EmployeeDetail');
var ses = JSON.parse(sesssion);
var intEmPKNo = ses[0].EmPKNo;
this._userService.get(Global.BASE_USER_ENDPOINT + '/MyAttendance?intEmPKNo=' + intEmPKNo)
.do(data => sessionStorage.setItem('MyAttendance', JSON.stringify(data)))
.subscribe(dashboard => {
this.dashboard = dashboard; this.indLoading = false;
this.PayPollHealth();
},
error => this.msg = <any>error);
}
PayPollHealth() {
var sesssion = sessionStorage.getItem('EmployeeDetail');
var ses = JSON.parse(sesssion);
var intEmPKNo = ses[0].EmPKNo;
this._userService.get(Global.BASE_USER_ENDPOINT + '/PayrollHealth?intEmPKNo=' + intEmPKNo)
.do(data => sessionStorage.setItem('PayRollHealth', JSON.stringify(data)))
.subscribe(dashboard => {
this.dashboard = dashboard; this.indLoading = false;
this.router.navigateByUrl('/dashboard');
},
error => this.msg = <any>error);
}
以便在执行所有函数后加载html,因为它需要将近30秒。
如何异步调用此函数?