Closed A77AY closed 2 years ago
Thank you for filing the issue, and making the pull request!
Can you give an example of a motivating use case for this change? Something to help me understand the purpose, and that could be used in docs/tests?
@ersimont I would like to use forms like this:
@Component({
selector: 'app-full-name-input',
template: `<div [form]="formControl"><input controlName="name" /><input controlName="lastName" /></div>`,
providers: [provideValueAccessor(FullNameFormComponent)],
})
class FullNameFormComponent extends WrappedAbstractControlSuperclass<{name: string; lastName: string}> {
formControl = new FormGroup({name: '', lastName: ''});
constructor(injector: Injector) {
super(injector);
}
}
or for example price + currency or something else
OK! I started playing with this example and I see the appeal. This allows you to use a FormControl, FormGroup, or FormArray and still get the benefits of things like automatically-updated disabled state. I'll try to look more into it soon! I haven't tried submitting a PR to a PR before (because I'll want to e.g. move some tests around). We'll see what I can do :)
OK I finally got around to paying this more attention! I'm thinking I'll just rename the existing class without keeping a subclass with the old name, like you did here. This means I will need to release it with version 13.
Let me know what you think about what I landed on: https://github.com/simontonsoftware/s-libs/commit/fb7cc7eb9fd052c49bf9132c0f8e40d45f7092b8
OK I finally got around to paying this more attention! I'm thinking I'll just rename the existing class without keeping a subclass with the old name, like you did here. This means I will need to release it with version 13.
Let me know what you think about what I landed on: fb7cc7e
Looks good (especially tests)
I faced with problem of specifying ngOnInit in inherited components. If you forgot to call parent ngOnInit, you may not understand this immediately. (I still have not decided for myself whether the library should solve this problem or not).
It looks like I may need to make that simple WrappedFormControlSuperclass
after all. Though all my tests passed, I just tried using my version in a real app compiled with Ivy & AOT and it wouldn't compile 😞 ðŸ˜
Closing this PR because its features have now been rolled into the version 13 branch.
Thank you again for the contribution!!