I have an ionic select with a list of users,
In this list i have an option that will redirect me to another page:
My problem is my select is waiting for the _id of the user, i want it to act differently with my last option ( the redirect )
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.
My problem is that it will thrrow an error about user._id, is there a way to avoid this with a handler please ?
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)
event.preventDefault(); // ?????
}