通过使用以下代码,无法设置离子2离子无线电

时间:2016-03-22 04:56:17

标签: ionic2

无法设置检查,使用以下代码,任何人都可以帮助我吗?

1

    <ion-radio checked="true" value="go"></ion-radio>

2

    <ion-list radio-group [(ngModel)]="status">
       <ion-list-header>Status</ion-list-header>
       <ion-radio (click)="changeStatus('0')" value="0">
        Status 0
       </ion-radio>
       <ion-radio (click)="changeStatus('1')" value="1">   
          Status 1
       </ion-radio>
       <ion-radio (click)="changeStatus('2')" value="2"> 
          Status 2
        </ion-radio>
    </ion-list>

1 个答案:

答案 0 :(得分:0)

试试这个

<ion-list radio-group [(ngModel)]="status">
   <ion-list-header>Status</ion-list-header>
   <ion-item>
   <ion-label>Status 0</ion-label>
   <ion-radio (click)="changeStatus('0')" value="0">  
   </ion-radio>
   </ion-item>
   <ion-item>
   <ion-label>Status 1</ion-label>
   <ion-radio (click)="changeStatus('1')" value="1">   
   </ion-radio>
   </ion-item>
   <ion-item>
   <ion-label>Status 2</ion-label>
   <ion-radio (click)="changeStatus('2')" value="2"> 
    </ion-radio>
    </ion-item>
</ion-list>

希望这会对你有所帮助。感谢

<强>更新

在你的address-list.html

<div class="address-list">
    <ion-list radio-group [(ngModel)]="recipientId"> 
        <!-- <ion-list-header> 请选择地址: </ion-list-header>  -->
        <ion-item *ngFor="#item of addresses">
            <ion-label>
                <h2 class="text-big text-color-light-grey">{{item.name}},{{item.phone}}</h2>
                <p class="text-thin text-color-light-grey">{{item.provice}} &nbsp;{{item.city}}</p>
                <p class="text-thin text-color-light-grey descr">{{recipientId}} == {{item.id}} - {{item.street}} {{item.address}}</p>
            </ion-label>
            <ion-radio (click)="selectAddress(item.id)" value="item.id"></ion-radio>
        </ion-item>
    </ion-list>
</div>

在address-list.ts中:

selectAddress(itemId) {
        this.recipientId = itemId;
    }