Skip to content

Model inside Array is not cleaned when Condition fails #769

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

Closed
doomie999 opened this issue Sep 13, 2016 · 3 comments
Closed

Model inside Array is not cleaned when Condition fails #769

doomie999 opened this issue Sep 13, 2016 · 3 comments

Comments

@doomie999
Copy link

doomie999 commented Sep 13, 2016

Expected behaviour

  • Given that a Condition is set on a property inside an Array
  • When the Condition is false
  • Then that property of the Model (that element inside the Array) should be cleaned as per the DestroyStrategy

Actual behaviour

  • That property of the Model (that Element inside the Array) retains any previous value entered, instead of being removed as per the default DestroyStrategy

Gist/Plunker/Demo

Plunker of the bug
The Array contains Objects with several properties:

  • helloText
    • conditional on a property outside the Array
  • foobar
    • used as target of condition
  • fooText
    • conditional on property inside the Array (foobar)
  • barText
    • conditional on property inside the Array (foobar)

Upon filling in helloText, fooText, barText, note that:

  • helloText retains its value even when hello is toggled to false
  • fooText retains its value even when foobar is switched to bar
  • barText retains its value even when foobar is switched to foo

Other notes

I've coded up a small fix for this, and will be adding a Pull Request subsequently.

@json-schema-form/angular-schema-form-lead

@Anthropic
Copy link
Member

@doomie999 we love PRs, so thank you for your efforts, I will continue to follow the PR so we can get it merged :)

@Anthropic
Copy link
Member

Made a gist link to test locally and want to remember it:
http://schemaform.io/examples/bootstrap-example.html#/f7078098dc03151c5a0cc18c6452aaea

@Anthropic
Copy link
Member

@doomie999 pleased to say this appears to be working in alpha.4 after some other remotely related changes to fix array behaviour. I have tested at depth yet, but I don't see why it wouldn't work, I will try to create a unit test at depth soon.

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