Angular6 forkJoin无法处理Angular 6中的动态URL数组

Angular6 forkJoin无法处理Angular 6中的动态URL数组,angular6,Angular6,但是,在我的例子中,我必须根据一些条件创建URL数组,所以静态添加它是不可能的。 如何解决此问题?您是否可以在函数的下面一行代码中,并在.reqArray.push(this.companyLocationService.locationsUpdate())行之后调用该函数:- forkJoin(this.reqArray).订阅( 数据=>{ forkJoin( this.reqArray.push(this.companyLocationService.locationsUpdate

但是,在我的例子中,我必须根据一些条件创建URL数组,所以静态添加它是不可能的。
如何解决此问题?

您是否可以在函数的下面一行代码中,并在.reqArray.push(this.companyLocationService.locationsUpdate())行之后调用该函数:-

forkJoin(this.reqArray).订阅( 数据=>{

forkJoin(
    this.reqArray.push(this.companyLocationService.locationsUpdate(1)),
    this.reqArray.push(this.companyLocationService.locationsUpdate(2)),
    this.reqArray.push(this.companyLocationService.locationsUpdate(3))
).subscribe(
    data => {

        console.log(data);

    });
希望这对你有所帮助

forkJoin(
    this.reqArray.push(this.companyLocationService.locationsUpdate(1)),
    this.reqArray.push(this.companyLocationService.locationsUpdate(2)),
    this.reqArray.push(this.companyLocationService.locationsUpdate(3))
).subscribe(
    data => {

        console.log(data);

    });
        console.log(data);

   },
   err => console.error(err)
);