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

expressionProperties - Required Expression #9

Closed
Wiljanneman opened this issue Feb 14, 2019 · 1 comment
Closed

expressionProperties - Required Expression #9

Wiljanneman opened this issue Feb 14, 2019 · 1 comment

Comments

@Wiljanneman
Copy link

Hi

Is there a way one can create an expression property for toggling required fields?

{ key: 'hideExpression', type: 'input', templateOptions: { label: 'Hide Expression' } },
Maybe something similar to what I used for the hide expression.

@franzeal
Copy link
Owner

franzeal commented Feb 16, 2019

I think the impediment to doing that with simple fieldGroup (expressionProperties) + input (templateOptions.required) is the latter's path. ngx-formly will break templateOptions.required into an object with a property when in this case you'd need the key preserved as is.

An approach that should work is to create a custom type that would interact with that part of the model:

{
    type: 'expressionProperty',
    templateOptions: {
        property: 'templateOptions.required'
    }
}
`

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

No branches or pull requests

2 participants