【发布时间】:2018-09-24 08:27:36
【问题描述】:
我正在使用 Ionic 3,我想实现 ion-select,我遵循了 ionic 文档,但我无法理解我的错误。我的代码在这里。
hosts: any[] = [
'*MANAGER*',
'Alberto Bellesini',
'Alessandro Rodeghero',
'Andrea Burla',
..............
];
在我的 html 中有
<ion-select [(ngModel)]="selectedHost">
<ion-label>From:</ion-label>
<ion-option *ngFor="let host of hosts" [value]="host"></ion-option>
</ion-select>
它不起作用。我可以看到与我的数组长度相等的无线电数量,但所有元素似乎都是空的或未定义的:我什么都看不到。我已经尝试将hosts 作为字符串数组,但结果是一样的。有人可以帮我吗?
【问题讨论】:
-
也许数组的长度有限制?因为我有 30 个元素
-
hosts: any[] = ['*MANAGER*', 'Alberto Bellesini']是糟糕的代码。请不要这样写
标签: typescript ionic3 angular5