I upgraded my Angular app from version 0.8.2 to 0.8.3 of Angular Schema Form (ASF) and this introduced a whopping great bug.
The forms in this app are multi-page forms and you move from one page to the next using prev/next buttons. A condition
is used to ensure that only the relevant fields are shown on each page of the form.
The form (model) data is stored in Firebase, but after upgrading to ASF 0.8.3, all the form data is deleted when you move to the next/previous page.
I had a look at the 0.8.3 release notes and I guess this is the reason for the change in behaviour
"destroyStrategy" support, thanks @jbsaff! This means that condition can now remove values from the model when their fields are hidden
Is there some way that I can disable this such that the data is not deleted when fields are hidden (when using version 0.8.3 or later)?
To prevent Angular from deleting the data when a field is hidden, set the global option destroyStrategy: 'retain'
, e.g.
<form sf-schema="schema"
sf-form="form"
sf-model="fireBaseModel"
sf-options="{destroyStrategy: 'retain'}"
name="current_form"></form>