Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何合并多个订阅 ngOnInit(){ this.getSubsidersByAppUserId(this.appUserId); this.getHistoricalRecordsBySerid(this.appUserId); } GetSubsidersByAppUserId(id){ this.appUserService.findByReportTo(id) .subscribe((appUserResponse:HttpResponse)=>{ this.substances=appUserResponse.body; }); } GetHistoricalRecordsBySerId(id){ this.jobPostingService.findHistoricalRecById(id) .订阅((jobPostingResponse:HttpResponse)=>{ this.historyRec=jobPostingResponse.body; console.log(“test>>”+this.historyRec.length); //log(“test>>”+JSON.stringify(this.client)); }); }_Angularjs - Fatal编程技术网

Angularjs 如何合并多个订阅 ngOnInit(){ this.getSubsidersByAppUserId(this.appUserId); this.getHistoricalRecordsBySerid(this.appUserId); } GetSubsidersByAppUserId(id){ this.appUserService.findByReportTo(id) .subscribe((appUserResponse:HttpResponse)=>{ this.substances=appUserResponse.body; }); } GetHistoricalRecordsBySerId(id){ this.jobPostingService.findHistoricalRecById(id) .订阅((jobPostingResponse:HttpResponse)=>{ this.historyRec=jobPostingResponse.body; console.log(“test>>”+this.historyRec.length); //log(“test>>”+JSON.stringify(this.client)); }); }

Angularjs 如何合并多个订阅 ngOnInit(){ this.getSubsidersByAppUserId(this.appUserId); this.getHistoricalRecordsBySerid(this.appUserId); } GetSubsidersByAppUserId(id){ this.appUserService.findByReportTo(id) .subscribe((appUserResponse:HttpResponse)=>{ this.substances=appUserResponse.body; }); } GetHistoricalRecordsBySerId(id){ this.jobPostingService.findHistoricalRecById(id) .订阅((jobPostingResponse:HttpResponse)=>{ this.historyRec=jobPostingResponse.body; console.log(“test>>”+this.historyRec.length); //log(“test>>”+JSON.stringify(this.client)); }); },angularjs,Angularjs,我在运行此代码时遇到问题,因为.subscribe无法立即获取2个数据。有什么简单的方法可以克服这个问题吗?在调整代码时会出现什么错误,请给出示例输出,以便用户能够轻松地提供帮助-目标是什么?为什么“立即”需要两组数据? ngOnInit() { this.getSubordinatesByAppUserId(this.appUserId); this.getHistoricalRecordsByUserId(this.appUserId); } getSub

我在运行此代码时遇到问题,因为.subscribe无法立即获取2个数据。有什么简单的方法可以克服这个问题吗?

在调整代码时会出现什么错误,请给出示例输出,以便用户能够轻松地提供帮助-目标是什么?为什么“立即”需要两组数据?
ngOnInit() {
        this.getSubordinatesByAppUserId(this.appUserId);
        this.getHistoricalRecordsByUserId(this.appUserId);
}


getSubordinatesByAppUserId(id) {
       this.appUserService.findByReportTo(id)
            .subscribe((appUserResponse: HttpResponse<AppUser[]>) => {
                this.subordinates = appUserResponse.body;
            });
    }



getHistoricalRecordsByUserId(id){
    this.jobPostingService.findHistoricalRecById(id)
        .subscribe((jobPostingResponse: HttpResponse<JobPosting[]>) => {
            this.historyRec = jobPostingResponse.body;
            console.log("test >>"+this.historyRec.length);
            // console.log("test >>"+JSON.stringify(this.client));
        });
}