小编kit*_*tty的帖子

如何使用角度提交后获取所选离子单选按钮的值

.html

<ion-radio-group 
    *ngFor="let option of data" 
    (ionChange)="checkValue($event)" 
    [value]="item">
   <ion-item>
       <ion-label>{{option.optionA}}</ion-label>
       <ion-radio slot="start" value="Not"></ion-radio>
   </ion-item>   
   <ion-item>
       <ion-label>{{option.optionB}}</ion-label>
       <ion-radio slot="start"  value="Some"></ion-radio>
   </ion-item>
   <ion-item>
       <ion-label>{{option.optionC}}</ion-label>
       <ion-radio slot="start" value="Most"></ion-radio>
   </ion-item>
   <ion-item>
       <ion-label>{{option.optionD}}</ion-label>
       <ion-radio slot="start" value="All"></ion-radio>
   </ion-item>
</ion-radio-group>

<div class="evalbtn">
    <button (click)="print(event)" class="nextbtn" (click)="evaluation2()">
        Submit
    </button>
</div>
Run Code Online (Sandbox Code Playgroud)

.ts

data: any[] = [
  {
    "optionA":"Not at All",
    "optionB":"For some of the Time",
    "optionC":"For most of the Time",
    "optionD":"For all of the Time",      
  }
];

//function to print what is inputed in the form that is declared …
Run Code Online (Sandbox Code Playgroud)

radio-button ionic-framework angular

3
推荐指数
1
解决办法
5397
查看次数

标签 统计

angular ×1

ionic-framework ×1

radio-button ×1