Skip to content

Instantly share code, notes, and snippets.

@ohabash
Created December 7, 2018 15:00
Show Gist options
  • Save ohabash/d098bcb277eb15b9a7192463350a3973 to your computer and use it in GitHub Desktop.
Save ohabash/d098bcb277eb15b9a7192463350a3973 to your computer and use it in GitHub Desktop.
configsWithP(): any {
const configs = this.configsService.getConfigsList;
const product = (id) => this.bcProductService.getProductById(id);
this.test_configs = configs.pipe(flatMap( configs_ret => {
const final = (configs_ret as any[]).map(config => product(config.id));
return zip(...final, (...args: any[]) => args).map(products => {
for (let i = 0; i < (configs_ret as any[]).length; i++) {
configs_ret[i]['p']=products[i].data;
}
return configs_ret;
});
}));
this.test_configs.subscribe(configss=> {
this.configs = configss;
this.merged = true;
this.configsExist = true;
this.configsService.Configs = configss;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment