RXJS 5.5以下判断方法执行完毕的回调写法:
1 this.saving = true; 2 this.service.createData(this.data) 3 .finally(() => { 4 this.saving = false; 5 }) 6 .subscribe((data) => { 7 this.notify.success(this.l('保存成功'), ''); 8 });
RXJS 5.5以上判断方法执行完毕的回调写法:
1 this.isLoading=true; 2 this.service.createData(this.data) 3 .pipe(finalize(()=>{this.isLoading=false;})) 4 .subscribe(data => { 5 this.notify.success(this.l('保存成功'), ''); 6 })