page.html中
<ion-content padding>
<div id="sectionTitle"> </div>
<ion-list>
<ion-item *ngFor="let question of questions" (click)="itemSelected(question)">
<ion-label>{{question.texto}} </ion-label>
<ion-select>
<option ng-selected="selected">{{answers[0].texto}}</option>
<ion-option text-wrap required *ngFor="let answer of answers; let i = index" onchange="itemSelected(answer)">
<p> {{answer.text}} </p>
</ion-option>
</ion-select>
</ion-item>
</ion-list>
<div class="sendButton">
<button ion-button full type="submit" (click)="toComparisonPage()">
Send
<!-- Here is where data must be retrieved -->
</button>
</div>
</ion-content>
page.ts
itemSelected(answer){
console.log("Selected item: ");
}
提前致谢!!
答案 0 :(得分:0)
您在代码上指定了ngModel。
<ion-select [(ngModel)]="selectedItems">
在你的page.ts中,你应该声明一个公共变量并且可以访问它。
console.log(this.selectedItems);
更多选择配置,直至离子文档 https://ionicframework.com/docs/api/components/select/Select/