-
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
Single field sub form interface #123
Comments
Hi @ntziolis, could you please create a small repro on Stackblitz https://stackblitz.com/fork/angular so we can understand if there's already an easy way of doing it and otherwise it'll be useful to discuss around that example? Thanks |
Will do |
Updated the issue with link to stackblitz and some notes |
@ntziolis I'm not saying this will happen but I'm considering the option. I think we could have for ex Here's an example of how it'd look: export class MySubForm extends NgxSubFormSingleValueComponent<T> {
protected getFormControls(): SingleFieldControl {
return {
control: new FormControl()
}
}
} the variable name Let me know what you think and also if you've got better names for the variables/classes 👍 |
@maxime1992 Yes that's 100% what I was looking for and in fact what I ended up doing (see below), key things for us were:
In regards to naming I think your name is better than the one I came up with ;)
|
Intent:
Allow for easy implementation of single value (no form group) custom components that implement value accessor interface. This would allow to create smart components like selects / autocompletes that load data themselves that can easily be reused across the application
Think customer / user / country pickers or any commonly used domain specific pickers you can think of.
Issue today:
NgxSubFormComponent
requires a complex type as generic parameter for class fields / methods to make senseformControlNames
etc.NgxSubFormRemapComponent
to wrap the single value into a form group and back but it generates boilerplate that is redundant and feels unnecessary especially for new devs joining a projectFeature request:
Create an additional interface that exposes the same functionality as
NgxSubFormComponent
orNgxSubFormRemapComponent
but all methods / fields should be singularformControlName
/formControlValue
etc.UPDATE:
https://stackblitz.com/edit/issue-demo-ngx-sub-form-single-value
Notes:
GenericLookupComponent
The text was updated successfully, but these errors were encountered: