[英]How can I choose just one Button in the Radio per row and per column?
我正在用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 {
}
}
}
}
这是行不通的。 请帮我。
抱歉,您的英语不是蛋上的黄色,所以我不明白您的问题,请您重复一遍;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.