angular-xeditable icon indicating copy to clipboard operation
angular-xeditable copied to clipboard

How to save empty ng-tags-input as array?

Open sinall opened this issue 5 years ago • 2 comments

If the model is not predefined, is there a way to save empty ng-tags-input as array? Here's the demo showing that ng-tags-input leaves model as undefined.

I also tried to reset the value in onbeforesave, but it didn't work.

In my case, the model is build dynamically based an other models, so it is not possible to initialize the model as empty array. So I'm trying to find a easy way to give it a default value. Currently I check and reset the model in save method of the form.

sinall avatar Apr 09 '20 13:04 sinall

Yeah, there isn't really a good way to overwrite the model data on save (see comments in #736)

Resetting the model in save seems like your best bet.

ckosloski avatar Apr 13 '20 21:04 ckosloski

@ckosloski So firstly should xeditable inputs save to model regardless the input text/value is empty or not? I mean do you consider this behavior a defect or it is by design? Currently I reset the model in save method, I was expecting the ng-tags-input do it implictly.

sinall avatar Apr 14 '20 02:04 sinall