shouldUpdateState hook

n some cases you might need to postpone state update to some time for example until field is valid. In this case you can do use shouldUpdateState method

const form = this.store.select(['my-form-state-path']).form
    .bind(myForm)
    .shouldUpdateState(this.shouldUpdateState);
shouldUpdateState = (params: ShoulUpdateStateParams) => {
    return true;
}

ShouldUpdateStateParams:

  • form: FormGroupLike form that has being synced

  • state: any - state before update

  • value: any - current value

This event will not be triggered if you are updating form state from the code manually

Last updated