I have a data id from a mondo db, where I store just the _id of the item in the data record for my object.
its a multi-select, so there might be more than 1
I use ion-select, and the select-option to be able to compare the data record _id, with the list of fields being shown
this worked in V4 angular
angular template segment
<ion-col >
<ion-select title="Tags" multiple="true" id="vtags" [(ngModel)]="thisviewer.Tags"
[compareWith]="checkSelectedTag" okText="Okay" cancelText="Dismiss"><ion-label>Tags</ion-label>
<ion-option *ngFor="let tag of data.Tags" value="{{tag._id}}">{{tag.value}}</ion-option>
</ion-select>
</ion-col>
vue template segment
<ion-col>
<ion-select
title="Tags"
multiple="true"
id="vtags"
okText="Okay"
cancelText="Dismiss"
compareWith="checkSelectedTag"
compare-with="checkSelectedTag"
>
<ion-label>Tags</ion-label>
<ion-select-option v-for="(tag) in tags" :key="tag.id"
value="tag.id" >{{tag.Value}}
</ion-select-option>
</ion-select>
</ion-col>
methods
methods: {
checkSelectedTag(tag1, tag2){
console.log('check tag, comparing '+tag1+' with '+tag2)
return tag1==tag2;
},
closeModal() {
console.log("in closemodal");
},
saveModal() {
console.log("in savemodal");
}
},
the save/close functions fire on push button in the mode
the OKAY and Dismiss buttons work on the options modal.
I have tried the property as
compareWith=
compare-with=
only the 1st three should be selected, but the function is never called.
2 posts - 1 participant