Rxjs ForkJoin的使用

时间:2021-07-03 15:44:32   收藏:0   阅读:25
const type$ = this.dictionaryService.findByCode(‘PUNISHMENT_TYPE‘);
const category$ = this.dictionaryService.findByCode(‘PUNISHED_CATEGORY‘);
const all$ = forkJoin([type$, category$]);
let colors = Object.keys(COLOR).length;
all$.subscribe(
result => {
this.types = result[0].dictionaryValues;
this.types.forEach(type=>{
this.punishedType[type.key] = {text: type.value, color: COLOR[type.showOrder % colors]};
});
this.categories = result[1].dictionaryValues;
this.categories.forEach(category=>{
this.punishedCategory[category.key] = {text: category.value, color: COLOR[category.showOrder % colors]};
})
}
);

原文:https://www.cnblogs.com/modestlin/p/14966209.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!