Skip to content
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

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

Open
sinall opened this issue Apr 9, 2020 · 2 comments
Open

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

sinall opened this issue Apr 9, 2020 · 2 comments

Comments

@sinall
Copy link

sinall commented Apr 9, 2020

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.

@ckosloski
Copy link
Contributor

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.

@sinall
Copy link
Author

sinall commented Apr 14, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants