-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global emissionRate for all NgxAutomaticRootFormComponent #184
Comments
Hi @alemputes, We've got a lot of them in our repo (+70) and what we've done is the following: @Directive({})
export abstract class AutomaticRootFormComponent<ControlInterface, FormInterface = ControlInterface>
extends NgxAutomaticRootFormComponent<ControlInterface, FormInterface>
implements OnInit, OnChanges {
public ngOnChanges(changes: SimpleChanges): void {}
// by default on the app we debounce auto saves
protected handleEmissionRate(): (obs$: Observable<FormInterface>) => Observable<FormInterface> {
return NGX_SUB_FORM_HANDLE_VALUE_CHANGES_RATE_STRATEGIES.debounce(300);
}
} And then into our app instead of extending from Would that be enough for you? Maybe one day if we require to declare an But for now we've been trying to keep that library as simple as possible and we don't have any module so that'd require a lot more changes than just the solution above. |
Yeah that directive should be enough, I actually need the one for NgxSubFrom as well so I made this one, is the OnInit and OnChanges really needed? Seems to work fine without them:
A NgxSubFromModule would be great, maybe this could part of your "Major architecture changes coming" 👍 Thank a lot for you fast replays Max, keep up the good work, really loving ngx-sub-forms. |
I guess not not sure why we've got that so yes feel free to remove that part 👍
I don't think that's going to end up there as the changes made internally + the ones visibles as part of the public interfaces is probably already enough haha. Closing as you seem to be happy with the solution above 👍 |
Thanks 🙏 Feel free to let us know how you're using the lib here and share your experience with others: #112 |
Hi, is there anyway we can set the emissionRate for all components that extend NgxAutomaticRootFormComponent?
Right now I need to do this in all my components:
protected handleEmissionRate(): (obs$: Observable<MailSettingsNotificationsForm>) => Observable<MailSettingsNotificationsForm> { return NGX_SUB_FORM_HANDLE_VALUE_CHANGES_RATE_STRATEGIES.debounce(1000); }
The text was updated successfully, but these errors were encountered: