We would like to be able to use the Upload Control with Typescript. But we have a requirement to not do an automatic upload, but to wait until associated form elements are completed.
Our scenario is someone fills out a form, associates the attachments using the control, then the user clicks 'Submit'. This submits the form first. Upon success, it gets the Id for the form record and then assigns that value to the File(s). Then it automatically calls the uploadFiles.
However, we cannot determine how in TypeScript to call the uploadFiles method. Do you have an example we can look at?
6 Answers, 1 is accepted
The most straight-forward approach to achieve the desired functionality would be to set the autoUpload property to false (so that selected file(s) is not automatically uploaded), and call the Upload component's uploadFiles() method programmatically when necessary.
You can also hide the built-in styling and buttons for uploading the files when selected and autoUpload is set to false, e.g.:
I hope this helps.
There must have been some temporary issue on the Plunker side, as I was able to open and run the Plunker as expected:
You can try clearing the browser cache and also running the plunker with the developer tools (F12) opened and refresh the page.
The main points of interest are setting the autoUpload property to false, and optionally hide the built-in buttons that will appear upon selecting a file, via CSS.
Thanks for your reply. I got pulled away on another project for a couple of days. I'm looking at this now.
Regarding the Plunker, it works in Chrome, but it struggles in Edge on Windows 10. Have you tried it there? If so and it works for you, I'll mess with my Edge later.
I'll get back to you.
That plunker gave us what we needed. So, the ability in the markup to define a selector(?) "#upload", what is that functionality in angular? Please give me a name and I'll look it up on the angular.io page.
Thanks so much for your help!
The Upload component is referenced as a template variable in this case. More information on the topic could be found here: