Ngx-formly: Display: none css style not removed when custom template is used with JSON Schema

Created on 15 Nov 2019  路  3Comments  路  Source: ngx-formly/ngx-formly

Description
I have a custom component for array types, when i add a hideExpression to my schema i expect my custom template to be hidden when setting a value in the model. I'm currently using JSON schema to render my fields.

My other fields that are not using custom templates show/hide perfectly such as the filterable field.

When I select grid in a dropdown i expect the size field to appear but it does not. However the filterable field appears.

Upon further inspection, display: none is not removed from the <formly-field> which contains the custom template.

Minimal Reproduction

https://stackblitz.com/edit/angular-qkrz6z

Your Environment

  • Angular version: 8.2.13
  • Formly version: 5.5.4
question

Most helpful comment

the above expression should be used in the repeatable section:
https://stackblitz.com/edit/angular-qkrz6z-9tkjj3

All 3 comments

related to https://github.com/ngx-formly/ngx-formly/issues/704#issuecomment-364661614 try with:

"hideExpression": "field.parent.model.display !== 'grid'"

Hi,

I have tried the above and I'm still experiencing the same issue. I also tried the formState.mainModel approach and no luck :(

"hideExpression": "field.parent.model.display !== 'grid'" works fine on the filterable boolean, but not the repeatable section.

I'm not sure what it could be.

the above expression should be used in the repeatable section:
https://stackblitz.com/edit/angular-qkrz6z-9tkjj3

Was this page helpful?
0 / 5 - 0 ratings