首页 > Web开发 > 详细

Rxjs ForkJoin的使用

时间:2021-07-03 15:44:32      阅读:24      评论:0      收藏:0      [点我收藏+]
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]};
})
}
);

Rxjs ForkJoin的使用

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!