iamguid / ngx-mf

Bind your model types to angular FormGroup type
MIT License
42 stars 2 forks source link

[QUESTION] Nested arrays support #1

Closed dominicegginton closed 2 years ago

dominicegginton commented 2 years ago

My Model:

export interface Model {
  foo: {
    bar: string,
    baz: string[],
  }[],
}

The form group type I want:

interface ... {
  foo: FormArray<{ bar: FormControl<string>, baz: FormArray<string> }>
}

This this possible with ngx-mf?

iamguid commented 2 years ago

Sure, you can, annotation should be { foo: [{ baz: 'array' }] } full example you can find here https://stackblitz.com/edit/angular-ngx-mf-gqrrau?file=src/app/app.component.ts

iamguid commented 2 years ago

But i found 1 small bug, in line https://stackblitz.com/edit/angular-ngx-mf-gqrrau?file=src%2Fapp%2Fapp.component.ts%3AL34,src%2Fapp%2Fmodel.ts type should be nullable, but in that example it nonNullable

iamguid commented 2 years ago

I fix it today

dominicegginton commented 2 years ago

Awesome thank you, this is what I was looking for 👍