我有一个带有2个按钮的页面。我希望一个在启动时被“激活”(起作用),然后,当用户单击一个按钮时,该按钮将被激活,而另一个将被禁用。由于某些原因,尽管加载时的行为很好,但是一旦开始单击,行为就会失败。我做错了什么?
模板
<div class="button-container">
<ion-button [ngClass]="{'activated': view === 'meetings'}" class="meeting-button" meetings (click)="changeView('meetings')"><ion-icon name="people"></ion-icon> <span stretch>Meetings</span></ion-button>
<ion-button [ngClass]="{'activated': view === 'tasks'}" class="task-button" tasks (click)="changeView('tasks')"><ion-icon name="list-box"></ion-icon><span stretch>Tasks</span></ion-button>
</div>
TS
this.view = 'meetings';
changeView(view) {
this.view = view;
}