store icon indicating copy to clipboard operation
store copied to clipboard

@ngxs/form-plugin, updating input kills extra properties in model

Open AlgoTrader opened this issue 8 years ago • 2 comments

I have a form model like this {id: 123, name: 'Anton'} id property is not shown in a form.

When I change name input, in the moment when the first change event triggered on input the id prop of the model is killed.

I think, the whole model is replaced (and as a result it kills all the props that are not used in form). I suggest the new data is to be merged into the model, not just replaced.

I certailnly don't like the killing effect. The only workaround is to make <input type='hidden'>

AlgoTrader avatar Apr 06 '18 12:04 AlgoTrader

The form model is mapped to formGroup by design, and one can always store any extra state outside of model or use sub-states to tackle this issue. @amcdnl can comment further on this.

tsawan avatar Apr 07 '18 10:04 tsawan

Ya, this is working as designed. You keep those in a separate object.

amcdnl avatar Apr 07 '18 16:04 amcdnl