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
没有更新以前的价值。