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)'時會打印什麼? –