1
我正在尝试一起执行多个Ajax调用。 我找不出这些线路有什么问题。好像订阅功能的第二输入作为处理组[],而不是授权[]Angular 2 - forkJoin不能绑定正确的黑客
Observable.forkJoin(
[this.userService.getAllGroups(),this.userService.getAllAuthorizations()]
)
.subscribe(
([groups,authorizations]) => {
this.groups = groups;
this.authorizations = authorizations; //error: Type 'Group[]' is not assignable to type 'Authorization[]'
this.loaderService.hideLoader();
},
(err)=>{
this.loaderService.hideLoader();
}
);
接口包括:
(method) UserService.getAllGroups(): Observable<Group[]>
(method) UserService.getAllAuthorizations(): Observable<Authorization[]>
任何人都可以帮助我了解什么是问题呢?
什么是'([团体,授权)=>'该怎么办? –
当''subscribe(...)'回调中的第一行添加'console.log(groups,authorizations)'时会打印什么? –