107
rated 0 times
[
114]
[
7]
/ answers: 1 / hits: 72158
/ 8 Years ago, wed, june 15, 2016, 12:00:00
I am using the SQLStorage from the Ionic platform. The remove
function returns a promise. In my code I need to remove multiple values. When these are all finished I need to execute some code.
How can I wait for all of these and then execute a callback function?
Code:
removeAll() {
this.storage.remove(key1);
this.storage.remove(key2);
this.storage.remove(key3);
}
Nesting all is a bad practise so I am looking for a decent solution :)
removeAll() {
return this.storage.remove(key1).then(() => {
this.storage.remove(key2).then(() => {
this.storage.remove(key3);
});
});
};
More From » angular