-
Notifications
You must be signed in to change notification settings - Fork 173
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
Issue with visibleIf in array items #479
Comments
That was not intentional. Thank you! |
Good to know! |
Oops, I don't have dynamically added elements with Maybe a solution would be to add a parameter to |
Hello,
While doing an upgrade to the latest version (2.10.0) of
ngx-schema-form
from the version 2.8.4, we stumbled upon an issue.The issue concerns the
visibleIf
property when it's on an array. If we definevisibleIf
in a property that is inside on an item of an array, this is not processed when it is created (after callingaddItem
), if the property exists in themodel
then thevisibleIf
property is processed correctly.Here you will find an example on stackblitz: https://stackblitz.com/edit/angular-3b5bsy?file=src%2Fmain.ts
chooseOne
is used to decide whether to show a furtherstring
object or not. In the modelmyModel
we setup an object and thevisibleIf
property gets updated correctly. If we use theadd
button then thevisibleIf
property is always shown whether we choose any option forchooseOne
.We believe that this change in behaviour was intruduced here: #454 calling
_bindVisibility()
fromngOnChanges
ofform.component.ts
instead of increateProperty
informpropertyfactory.ts
Was this change in behaviour intentional ? Or is it a undesired side effect ?
If it was intentional, what would be the correct to define such property in our schema?
For the moment, in our implementation we had a custom component that implemented
ArrayWidget
, in this component we overrideaddItem
and there we callthis.formProperty._bindVisibility()
. This seems to solve this issue for the time being.Thanks for your help!
The text was updated successfully, but these errors were encountered: