I have this filter modal in which i can choose a country to show. Now, when i already have a selected country then i open the modal and close it without making a new selection, i still want that specific previously selected country to show only. Right now, all the items are displayed in this case. How can i fix this?
modal.ts
closeModal(data) {
this.viewCtrl.dismiss(data?data:null);
}
country.ts
myModal.onDidDismiss(data => {
let selectedCountry = data;
console.log(selectedCountry)
if(selectedCountry === null || selectedCountry === 'all'){
return this.modifiedItems = this.items
}
else {
this.modifiedItems = this.items.filter((data) => {
return data.location === selectedCountry
})
}
});
myModal.present();