【发布时间】:2021-01-06 21:44:26
【问题描述】:
我有离子按钮
<ion-button expand="block" share="round" (click)="connectOrdisconnect()" [disabled]="(loading$ | async)">
<ion-label > <ion-spinner *ngIf="loading$ | async"></ion-spinner> connectOrdisconnect</ion-label>
</ion-button>
ngOnInit() {
this.loading$=this.printService.printerConnecting;
this.loading$.subscribe(es => {
//how to change the color and text of ion-button
// setTimeout need to run without troubles with ng changes detector
setTimeout(_=>{this.changeDetectorRef.detectChanges()},0);
});
}
我正在使用 ionic 5 形式..我需要根据加载 $ 可观察值更改更改文本和颜色(蓝色/红色)..请告诉我
【问题讨论】: