在Angular中更改另一个组的事件时更改组的切换状态

问题描述

我有一个测验应用程序的场景,在该场景中,我选择一个答案,然后转到下一个问题,依此类推。 现在,当我回到旧问题时,它希望它向我显示我在该问题上选择的答案。我找不到解决方法。另外,我检查了其他答案,但是没有一个帮助。

HTMLCode:

<mat-button-toggle-group (change)="toggleChangeQuestion($event)" name="selectQuestions" #group2="matButtonToggleGroup">
            <mat-button-toggle checked value="0">01</mat-button-toggle>
            <mat-button-toggle value="1">02</mat-button-toggle>
            <mat-button-toggle value="2">03</mat-button-toggle>
            <mat-button-toggle value="3">04</mat-button-toggle>
            <mat-button-toggle value="4">05</mat-button-toggle>
</mat-button-toggle-group>

<mat-button-toggle-group multiple (change)="toggleChange($event)" name="answers" #group1="matButtonToggleGroup">
              <mat-button-toggle value="a">A</mat-button-toggle>
              <mat-button-toggle value="b">B</mat-button-toggle>
              <mat-button-toggle value="c">C</mat-button-toggle>
              <mat-button-toggle value="d">D</mat-button-toggle>
</mat-button-toggle-group>

如何在#group2按钮的拨动开关上控制/更改#group1按钮的选中状态?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)