@Injectable()
export class UsersResolver implements Resolve<any> {
loading = false;
constructor(private store: Store<AppState>) { }
resolve(route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<any> {
return this.store
.pipe(
select(isUserLoaded),
tap(userLoaded => {
if (!this.loading && !userLoaded) {
this.loading = true;
this.store.dispatch(loadingUsers({
pagination: {} // **Here i want to get my pagination details from selectUserPagination state**
}));
}
}),
filter(userLoaded => userLoaded), // only proceed further only in case of coursesLoaded is true
first(), // Wait for first observable to get values or error
finalize(() => this.loading = false) // Runs in last
);
}
}
所以想选择我的 userPagination 状态并将其分派到 loadingUsers 操作中。
如何将多个选择添加到此解析器中,然后分派该操作?