我有两个单选按钮组,我向其中添加了角度形式控件。我遇到的问题是,当我添加控件时,单选按钮分组消失了。此外,当我检查单选按钮时,它的name属性也消失了。结果是我无法再在不同的单选按钮组之间正确切换。我怎样才能解决这个问题?
示例: https: //stackblitz.com/edit/angular-qdqnmo
TS:
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent implements OnInit {
formData = {
"questions": [
{
"refCode": "Question1",
"answers": [
{
"refCode": "Question1Answer1",
"selected": true
},
{
"refCode": "Question1Answer2",
"selected": false
}
]
},
{
"refCode": "Question2",
"answers": [
{
"refCode": "Question2Answer1",
"selected": false
},
{
"refCode": "Question2Answer2",
"selected": false
},
{
"refCode": …Run Code Online (Sandbox Code Playgroud)