简体   繁体   English

如何在单行和每列中仅选择单选按钮?

[英]How can I choose just one Button in the Radio per row and per column?

I am programming in Angular and just want to give the opportunity to click on button per row and per column. 我正在用Angular编程,只是想给机会单击每行和每列的按钮。 How can you do this? 你该怎么做?

This is the code I already have: 这是我已经拥有的代码:

component.html: 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: 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 {
    }
  }
}

} }

It does not work. 这是行不通的。 Please help me. 请帮我。

抱歉,您的英语不是蛋上的黄色,所以我不明白您的问题,请您重复一遍;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在一个查询中,每行保存一个数组。 我怎样才能做到这一点? - Save an array Row per Row in one query. How can I do that? 如何以字符串形式返回每行数组中的所有内容? - how can I return as a string with everything in the array per row? 如何为每个gridview行定义一个javascript数组? - how can I define a javascript array per every gridview row? 我需要在ui-grid中显示一个字符串数组。 单列,每行一个字符串 - I need to display an array of strings within ui-grid. Single column, one string per row 如何根据要填充的列 header 中输入的内容,使查询列动态化? - How can I make queried column dynamic, as per what's entered in the column header to be populated? "我如何打印每个coloms的数组" - How i can print the array per coloms 如何返回每个字段/列只有一个值的结构化数组? - How to return structured array with only one value per field/column? 如何从 mongoDB 获取 map 字符串数组并在每个帖子中显示一个特定的标题/正文 - How can I map string array taken from mongoDB and show one specific title/body per post PHP / Postgres 每行一个输出 - PHP / Postgres One Output per row 如何在每个按钮专用于一个数组值的情况下使用单选按钮? - How can I use radio button where each button is dedicated to one array value?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM