我正在尝试将图像放入SelectIonic 2中的组件中:我已将图像源文件放在www/imgIonic 2项目的文件夹中.但是,使用简单的img-tag不会使用此代码显示任何图像:
<ion-list>
<ion-item>
<ion-label>Gaming</ion-label>
<ion-select [(ngModel)]="gaming">
<ion-option value="nes">
NES
<img src="img/myImage.png">
</ion-option>
</ion-select>
</ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud)
有谁有想法吗?
我正在开发Ionic 2中的应用程序.我需要以动态的方式添加离子选择选项,但我对可能非常简单的事情感到难过.这是我的代码片段.
<ion-select [(ngModel)]="classifications" (ngModelChange)="updateSelectedValue($event)">
<ion-option *ngFor="#key of classifications" value="key" [checked]="true">{{key}}</ion-option>
Run Code Online (Sandbox Code Playgroud)
this.classifications = this.local.get('classifications')._result;
console.log('classifications: '+ this.local.get('classifications')._result);
updateSelectedValue(event:string):void {
this.selectedObject = JSON.parse(event);
console.log('selectedObject: '+this.selectedObject);
}
Run Code Online (Sandbox Code Playgroud)
控制台日志的输出:
classifications: ["Any","Agriculture, Forestry, And Fishing","Mining","Construction","Manufacturing","Transportation, Communications, Electric, Gas, And Sanitary Services","Wholesale Trade","Retail Trade","Finance, Insurance, And Real Estate","Services","Public Administration "]
Run Code Online (Sandbox Code Playgroud)
我也得到了例外.
EXCEPTION: Cannot find a differ supporting object '["Any","Agriculture, Forestry, And Fishing","Mining","Construction","Manufacturing","Transportation, Communications, Electric, Gas, And Sanitary Services","Wholesale Trade","Retail Trade","Finance, Insurance, And Real Estate","Services","Public Administration "]' in [classifications in JobsearchPage@30:17]
Run Code Online (Sandbox Code Playgroud)
编辑:
它没有设定其选择的价值.我在Angular 1中做过这个.
<select id="classificationId" …Run Code Online (Sandbox Code Playgroud)