Angular 单选按钮的值在屏幕上显示不同
我正在使用ionic,我想在单选按钮上显示带有值的数据。我在获取值并将其设置为正确值时遇到问题 index.html 输出: 应该是Angular 单选按钮的值在屏幕上显示不同,angular,typescript,button,ionic2,Angular,Typescript,Button,Ionic2,我正在使用ionic,我想在单选按钮上显示带有值的数据。我在获取值并将其设置为正确值时遇到问题 index.html 输出: 应该是 <td *ngFor="let learn of learningtest"> <table> <tr> <td *ngFor="let btn of learn.Buttons"> <input type="radio" [(ngModel)]="
<td *ngFor="let learn of learningtest">
<table>
<tr>
<td *ngFor="let btn of learn.Buttons">
<input type="radio" [(ngModel)]="learn.selectedAnswer"
name="button{{idx}}"
[value]="btn">
button{{idx}}
{{btn | json}}
</td>
</tr>
</table>
</td>
按钮{{idx}
{{btn | json}}
使用[(ngModel)]
也可以使用嵌套的ngFor
应该是
<td *ngFor="let learn of learningtest">
<table>
<tr>
<td *ngFor="let btn of learn.Buttons">
<input type="radio" [(ngModel)]="learn.selectedAnswer"
name="button{{idx}}"
[value]="btn">
button{{idx}}
{{btn | json}}
</td>
</tr>
</table>
</td>
按钮{{idx}
{{btn | json}}
使用[(ngModel)]
也可以使用嵌套的ngFor
请使用正确的标记(angular/angularjs,是哪一个?)看起来像angular(v.2+),但使用属于angularjs的语法,至少我看到了使用
ng model
;)使用[value]=”。“
或ngValue=“…”
除了添加到@devqon之外,它还应该使用[(ngModel)]
而不是ng model
谢谢。但仍然没有显示值请使用正确的标记(angularjs/angularjs,是哪个?)看起来像angular(v.2+),但使用属于angularjs的语法,至少我看到了使用ng model
;)使用[value]=”。“
或ngValue=“…”
除了添加到@devqon之外,它还应该使用[(ngModel)]
而不是ng model
谢谢。但是仍然没有显示值检查演示附件这是一个下拉列表?谢谢伙计!真的很有帮助他检查演示附件这是一个下拉列表?谢谢伙计!真是帮了大忙呵呵
<td *ngFor="let learn of learningtest">
<table>
<tr>
<td *ngFor="let btn of learn.Buttons">
<input type="radio" [(ngModel)]="learn.selectedAnswer"
name="button{{idx}}"
[value]="btn">
button{{idx}}
{{btn | json}}
</td>
</tr>
</table>
</td>