HTML:
- <button mat-raised-button class="btn btn-linkedin mat-raised-button pull-right" (click)="onSubmit()" [disabled]="!loading">Submit</button>
复制代码
JS:
- onSubmit() {// Disable Create Buttonthis.loading = true;this.xxxService.createXXX(this.formData) .pipe(first()) .subscribe({ next: (data) => { if (data.successful) { this.commonService.showNotification('success', 'Creation successful'); this.router.navigate(['/xxx/detail/' + data.returnedObject.xxId], { relativeTo: this.route }); } else { this.commonService.showNotification('danger', data.errorStr); this.loading = false; } }, error: error => this.commonService.handleError(error), });}
复制代码 |