作者:我就是我 | 来源:互联网 | 2023-09-16 10:20
我想获取表格中选中的单选按钮的编号,以保存该编号并将其传递给进度条。
{{n.display}}
我的进度栏是这样:
progress bar image
![如何计算已检查的单选按钮的数量?角度的 如何计算已检查的单选按钮的数量?角度的](https://img.php1.cn/3cd4a/1eebe/cd5/e88efe5b0a13a7fa.webp)
进度条的代码为:
在我的.ts y中,电话号码已硬编码
progressnumber:number = 70;
嗨,您可以检查单选按钮的更改事件,并添加到可以触发事件并读取如下值的值
.ts
import { Component } from '@angular/core';
import { MatRadioChange } from '@angular/material';
@Component({
selector: 'app-root',templateUrl: './app.component.html',styleUrls: ['./app.component.css']
})
export class AppComponent {
progressnumber:number = 70;
clientID = 70; // I dont know what is your model.clientID is i just use it clientID and fixed a initial value of it you can use yours
clients : any[] = [
{value:70,display:'client 1'},{value:40,display:'client 2'},{value:50,display:'client 3'}
]
radioChange(event : MatRadioChange){
this.progressnumber = event.value
}
}
.html
{{n.display}}
工作示例
https://stackblitz.com/edit/angular-material-m1