I have an ionic select with a list of users, In this list I have an option that will redirect me to another page: in my list I have an item that will act like a button at the moment it will select it and redirect me, I only want it to act like a button and don't be selected, so the selector keep the first item of the list selected
My list:
My Image so you can understand
Is there a way to handle this please ?
<ion-select interface="popover" [ngModel]="selecteduser._id" (ngModelChange)="selectUser($event)" (ionChange)="onChange($event)">
<ion-option *ngFor="let user of users" [value]="user._id">
</ion-content>{{ getUserNickname(user }} </ion-option>
<ion-option>Go To Modal</ion-option>
</ion-select>
So I want when I click on my Go To Modal, it will redirect me to my modal. without selecting it.
There is my ts
onChange(value: any) {
if (value === 'Go To Modal') {
this.openConfig()
}
}
openConfig() {
this.modalCtrl.create(configModal).present()
console.log('heeey')
}
selectUser(userId: string) {
this.selectedUser = this.users.find(b => b._id === userId)
this.onSelect.emit(this.selectedUser)
}
在您的html代码中:找到额外的结束标记</ion-content>
并且您的Go To Modal选项应包含一些值,例如<ion-option value="Go To Modal">Go To Modal</ion-option>
作为您的其他选项包含一些价值
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.