Skip to content
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

Displaying input types within a custom input type #3883

Open
rkt739 opened this issue Mar 22, 2024 · 0 comments
Open

Displaying input types within a custom input type #3883

rkt739 opened this issue Mar 22, 2024 · 0 comments
Labels

Comments

@rkt739
Copy link

rkt739 commented Mar 22, 2024

I'm trying to create a custom input type (multiField) which displays multiple arbitrary inputs within itself. It seems like the formly-field directive should make this reasonably doable. I should just be able to put a list of fields inside the JSON element for the multiField element and have them show up.

The problem is that this only seems to work if I put those fields in a fieldGroup property. If I put them elsewhere, a bunch of properties don't get tacked on and so the fields don't work. (Obviously I'm pointing the template to where the fields are in each case.)

This way works:

{
  type: 'multiField',
  fieldGroup: [
    // some fields
  ]
}

This way does not:

{
  type: 'multiField',
  templateOptions: {
    fields: [
      // some fields
    ]
  }
}

Normally I would just do it the first way because obviously that's what works. But I'm trying to upgrade an old system from angular-formly, and I think some of the existing data does it the second way. So I'd really like to make that work too.

Live demo: https://stackblitz.com/edit/ngx-formly-ui-bootstrap-4jiein?file=src%2Fapp%2Fapp.module.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant