我正在用Angular编程,只是想给每一次单击每行和每列按钮的机会。你该怎么做?
这是我已经拥有的代码:
component.html:
<div class="kan1FuerLinks">
<div class="kan1" *ngFor="let test of tests; let i = index">
<a>{{test}}</a>
<mat-radio-group >
<mat-radio-button (click)="getValue(i, 1)" value="1" [disabled]="arrayValue[i][1]">1</mat-radio-button>
<mat-radio-button (click)="getValue(i, 2)" value="2" [disabled]="arrayValue[i][2]">2</mat-radio-button>
<mat-radio-button (click)="getValue(i, 3)" value="3" [disabled]="arrayValue[i][3]">3</mat-radio-button>
<mat-radio-button (click)="getValue(i, 4)" value="4" [disabled]="arrayValue[i][4]">4</mat-radio-button>
<mat-radio-button (click)="getValue(i, 5)" value="5" [disabled]="arrayValue[i][5]">5</mat-radio-button>
<mat-radio-button (click)="getValue(i, 6)" value="6" [disabled]="arrayValue[i][6]">6</mat-radio-button>
</mat-radio-group>
{{buttonValue}}
</div>
component.ts:
getValue(getI: number, val: number) {
this.buttonValue[getI][val] = val;
for (let i = 0; i < this.tests.length; i++) {
for (let j = 0; j < 6; j++ ) {
if (this.buttonValue[getI][j] === this.buttonValue[i][j] && this.buttonValue[getI] !== this.buttonValue[getI]) {
this.arrayValue[getI][val] = true;
} else {
}
}
}
}
它不起作用。请帮助我。
答案 0 :(得分:0)
抱歉,您的英语不是蛋上的黄色,所以我不明白您的问题 能否重复一遍;)