Timeline for how to reset <input type = "file"> in Angular
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 26, 2019 at 22:39 | comment | added | CodeFinity |
Just resetting the value like in other answers seems much more straightforward than manipulating the DOM.
|
|
Oct 23, 2015 at 21:10 | comment | added | Robert Koritnik | @RogerRussel: Exactly... I was wondering myself how come upper answers were saying that it only works once which is a clear indicator that some sort of reference is being lost. And that was actually the case because the initially created the input reference that was later replaced with a new input element. | |
Sep 14, 2015 at 23:08 | comment | added | Roger Russel | @SarthakSinghal, Unfortunately you wrote the wrong code, you should have done jsfiddle.net/cL1LooLe | |
Aug 7, 2015 at 14:19 | comment | added | Gyrocode.com | @SarthakSinghal, that's exactly what I meant. The answer above (demonstrated by this jsFiddle) doesn't work because once file is upload the second time the reset stops working. I'm surprised this incorrect answer got so many votes. For a better solution, see this answer or this answer. | |
Aug 7, 2015 at 9:40 | comment | added | Sarthak Singhal | @Gyrocode.com This jsFiddle doesn't work if the image is uploaded second time after reset. | |
Jul 31, 2015 at 17:40 | comment | added | Gyrocode.com | Unfortunately this doesn't reset input value, see this jsFiddle. For a better solution, see this answer. | |
May 14, 2015 at 14:21 | review | Suggested edits | |||
May 14, 2015 at 14:48 | |||||
Jun 18, 2014 at 9:55 | history | answered | pixparker | CC BY-SA 3.0 |