Hi, i have a problem that is not completly related to ionic it’s angular in General
the problem is that i have many custom made modals in my app and i need to close them when device back button is pressed so i made a Global.ts file and made the controller variable in them :
export let Global = {
modals: {
showFilter: false,
showAddress: false,
showLanguage: false,
showTheme: false,
showNotification: false
},
}
i’m trying to close it from app.component.ts
this.platform.backButton.subscribeWithPriority(1, async () => {
let shouldReturn = false;
for (let [key, value] of Object.entries(this.global.modals)) {
if (this.global.modals[key] && !shouldReturn) {
this.global.modals[key] = false;
console.log(this.global.modals[key]);
shouldReturn = true;
}
}
console.log(this.global.modals);
if (shouldReturn) {
return;
}
}
so the problem is that the code is working and the true variable is becoming false in order to close the modals but it’s true that the modal is closed but the modal won’t close
the example of working code is that my modal is inside tabs component and the modal open call is in another component and they are working like charm.