我正在研究ionic2项目.我使用离子选择元素.
我搜索了一种方法,以编程方式关闭选择框选择任何项目(而不是等待用户按OK).
<ion-select id="select" #select>
<ion-option (ionSelect)="closeAndSave()" *ngFor="let option of enumList" [value]="option">{{ option}}</ion-option>
</ion-select>
Run Code Online (Sandbox Code Playgroud)
`
class myClass{
@viewChild('select') select:Select;
closeAndSave(){
/*it is come here on press any option. but how can I close here my select element? I tried: this.select.destroy() - not do any thing. any solution?*/
}
Run Code Online (Sandbox Code Playgroud)
`
ionic2 ×1