如何使用 NgRx select 作为 Subject 而不是 BehaviorSubject
How to use an NgRx select as Subject instead of BehaviorSubject
有没有办法将 NgRx select 视为 Subject
而不是 BehaviorSubject
?
我不想在第一次订阅时执行下一步(默认行为)。相反,想在状态改变时执行它。
this.store.pipe(select(fromAuth.selectErrorMessage)).subscribe((message) => {
/* This content is executed the first time the subscription is made,
and after that is executed everytime the state change */
this.isLoading = false;
this.errorMessage = { ...message };
});
this.store.pipe(select(fromAuth.selectErrorMessage)).pipe(skip(1))
将忽略当前值,只发出下一个值。
有没有办法将 NgRx select 视为 Subject
而不是 BehaviorSubject
?
我不想在第一次订阅时执行下一步(默认行为)。相反,想在状态改变时执行它。
this.store.pipe(select(fromAuth.selectErrorMessage)).subscribe((message) => {
/* This content is executed the first time the subscription is made,
and after that is executed everytime the state change */
this.isLoading = false;
this.errorMessage = { ...message };
});
this.store.pipe(select(fromAuth.selectErrorMessage)).pipe(skip(1))
将忽略当前值,只发出下一个值。