【发布时间】:2017-11-10 03:01:26
【问题描述】:
我想向用户显示 0 -> 术语到下拉列表中
请查收https://stackblitz.com/edit/ionic-djze7u
home.html
<ion-content padding>
<ion-card>
<ion-card-content *ngFor="let item of users">
<ion-row>
<ion-label>{{item.name}}:</ion-label>
<ion-label>{{item.age}}</ion-label>
<ion-select [(ngModel)]="count">
<ion-option value="0" selected>0</ion-option>
//这里有问题->如何再次使用ngfor做一个lopp? //以及如何将 i 的值打印到 user.terms?
<ion-option ngfor="let i of item.term" value="{{i}}" >
{{i}}
</ion-option>
</ion-select>
</ion-row>
</ion-card-content>
</ion-card>
</ion-content>
home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
users:any = [
{ name: 'Composite Factory', age: 1, term:2 },
{ name: 'Todd', age: 2, term:1 },
{ name: 'Lisa', age: 3, term:4 }
];
constructor(public navCtrl: NavController) {
}
}
【问题讨论】: