I'm loading list of users using ngrx:
this.users$ = this.store.select(fromReducer.getUsers);
and in my html:
<ul>
<li *ngFor="let user of users$ | async">
{{user.id}} - {{user.name}} - {{user.email}}
</li>
</ul>
I should display the list as i did, but also make another end point call to get the user that has id=1 phone address.
How can i do that? the second call is depends on the data from the 1st one.
should i make another action inside my effect?
@Effect()
loadAllUsers$: Observable<Action> = this.actions$
.ofType(fromActions.SHOW_ALL_USERS)
.switchMap(() =>
this.articleService.getAllUsers()
.map(data => new fromActions.ShowAllUsersSuccessAction(data))
);
thanks
effect
for that. Then you can make a selector combining both of those. ex.createSelector(getUsers, fromPhone.getUsersPhone, (user, phone) = { ... your mapping here ... }
– penleychan