Reset ionic modal inputs after closing modal

when i first initialize one of my modals, it has 4 checkboxes all initialized to ‘false’. i then check some boxes and ‘hide’ the modal, upon opening the modal again, all the checkboxes i checked are still checked. how can i have the modal reset upon opening it every time?


Hey did you manage to solve your problem? I have the same problem, so it would be good to know how you fixed this? I came across this SO question, but I do not think it is quite the same problem as presented by this question.

you’re going to need to set an id on all the fields that you want to clear, in fact you’re going to want to set an id for any field you put in a modal, or maybe anywhere even in your app.

then to get the value you can get it with this and set it to a variable for example:

 *var textAreaData = document.getElementById('textCommentTextArea').value;*

you can also clear that field by doing:

 *document.getElementById('textCommentTextArea').value = ''*

now as for checkboxes it’s the same thing, you’re gonna need to set an id again:




hope this helps! feel free to post any problems you’ve had here, i’ve done a pretty large project in ionic and have run into many obstacles.

Thanks for the answer jamesdo. I managed to solve it another way and just now, I have written a blog post about that. I have also made a reference to your answer in that post.