Initially input field not mandatory but still submit button disabled?

前端 未结 2 1169
滥情空心
滥情空心 2021-01-29 07:01

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

相关标签:
2条回答
  • 2021-01-29 07:35

    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

    0 讨论(0)
  • 2021-01-29 07:51

    Issue resolved when remove '(DetailModel.dirty)'

    0 讨论(0)
提交回复
热议问题