2021年4月2日星期五

Change and grey out button until Observable Broadcasts successfull

component.html

    <button mat-raised-button color="primary" type="submit">          <mat-icon>account_box</mat-icon>          <span *ngIf="!loading">&nbsp;&nbsp;&nbsp;Register</span>          <span *ngIf="loading">&nbsp;&nbsp;&nbsp;Processing Request</span>      </button>  

component.ts

this.auth.register(this.registerUser).subscribe(      (success) => {        this.loading = true;      },      (err) => {        this.success = false;        this.warning = err.error.message;        this.loading = false;      },      () => {        this.success = true;        this.warning = null;        this.loading = false;                }    );  

I want to change the Register button to Processing request and grey it out until the observable finishes broadcasting.

Currently, nothing changes even when loading is false.

https://stackoverflow.com/questions/66927291/change-and-grey-out-button-until-observable-broadcasts-successfull April 03, 2021 at 10:49AM

没有评论:

发表评论