I check input field validation like below. Some data input field needs to be filled and the button should be disabled. In mandatory case it works fine (console.log -> called
Maybe If you change your code to this, will help.
ngOnInit(): void {
this.DetailModel$.pipe(
switchMap(opd => {
this.detail = opd as Detail;
const date = this.detail?.time;
const planDate = date !== undefined ? date : new Date();
//according date select reviews data
return this.store.select(selectAllReviewsDetailsModel(planDate))
})).subscribe(res => {
this.Reviews = res;
//need to call after change Details
this.isCommentMandatory(this.Reviews);
});
}
With that change, isCommentMandatory()
will run after store.select
For more:
SwitchMap - Rxjs
Issue resolved when remove '(DetailModel.dirty)'