Q:

Dynamic number of Promise in Angularfire2

I am bulding my project in Ionic2 using Firebase and Angularfire2.
In a method I want to wait for multiple Promise to return. So I am using following approch.
deleteAll(param: string[]) {
  return Promise.all([
    this.storage.remove(param[0]),
    this.storage.remove(param[1]),
    this.storage.remove(param[2])
  ]);

But in my case the number of values in param array is not fixed. If i try to use for loop in side method Promise.all its throughing error. 
Please help me resolve this scenario.

A:

You can just use map to convert the string array into an array of promises and then pass that to Promise.all
let promises = param.map(x => this.storage.remove(x));
return Promise.all(promises);

