Angular:formControl.setValue(2, { emitEvent: false }) 在 valueChanges.pipe(startWith(startValue), pairwise()) 时不更新 prev 的值

问题描述 投票:0回答:0

dispatchCurrentEvent 的通用函数

control.valueChanges.pipe(
          startWith(startValue), 
          pairwise())
          .subscribe(([prev, next]: [any, any]) => {
            if (prev != next) {
             this.controlService.dispatchCurrentEvent({
                type,
                field,
                preValue: prev,
                value: next,
                section,
                rIndex,
          });
          if (field.rules?.length) 
              this.pvRulesService.handleRules(field, section, field?.rowIndex);
         }
    });

formControl.setValue(1, { emitEvent: false });

不更新 prev

的值
control.valueChanges.pipe(
         startWith(startValue),
         pairwise())).subscribe(([prev, next]: [any, any])

想在

formcontrol.setValue(1,{ emitEvent: false })
时设置prev的值。但是
emitEvent:false
没有更新以前的价值。

angular
© www.soinside.com 2019 - 2024. All rights reserved.