question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Formly 6 Preset with multiple fields

See original GitHub issue

Hi, is possible to have other example of Formly 6 Presets with multiple fields? The example from the guide explain to configure only one select like this:

getConfiguration(): FormlyFieldConfig {
        return {
            key: 'salutation',
            type: 'select',
            props: {
                label: 'Salutation',
                placeholder: 'Please Select',
                options: this.salutationOptions.map((salutation) => ({ label: salutation, value: salutation })),
            },
        };
    }

I would configure an array of FormlyFieldConfig and not in the AppModule. Is this possible now ? Thank you so much for the incredible framework!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MaxKlesscommented, Oct 26, 2022

Sorry super busy atm but I’ll make a PR soon 😃

1reaction
aitboudadcommented, Oct 17, 2022

By default when fieldGroup is present, the default value is replaced but anyway I see the needs. We’ll try provide a fix in 6.1.

@MaxKless we need to pass the original field to getConfiguration() function, in order to let users do the merge, here is an example:

export class AdressPresetProvider {
    constructor(@Inject(ADDRESS_OPTIONS) private adressOptions: string[]) {}
    getConfiguration(f: FormlyFieldConfig): FormlyFieldConfig {
        return {
          fieldGroup: [ 
            { key: 'province', ... },
            { key: 'city', ... },
            ...f.fieldGroup,
          ]
        }
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Formly Expressions
Expressions allow you to dynamically change field properties. For example, you can disable a form field dynamically. The value of this property can...
Read more >
Issues · ngx-formly/ngx-formly - GitHub
Contribute to ngx-formly/ngx-formly development by creating an account on GitHub. ... Formly 6 Preset with multiple fields enhancement.
Read more >
Implement multi-column layout Forms with Angular Formly
In this lesson we'll have a look how to implement such a multi-column form with Formly. Note, future versions of Formly might even...
Read more >
@ngx-formly/core | Yarn - Package Manager
Easy to extend with custom field types, validation, wrappers and extensions. ⚡️ Supports multiple schemas: Formly Schema (core); JSON Schema. A bunch of ......
Read more >
Working with Formly - Part 2 - Excellarate
Layouts from the Formly library helps us design responsive forms with modern aesthetics. ... Without wrapper classes, all the fields will display ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found