It would be nice to have 60% of the file-upload code as stand alone for file selection (without upload). This throwing a (selected) event when a file is selected and an API to get the selected file + clear it (up for debate on the API).
Acting as a <input file="type"> but following the MD specs.
Create an atom for reusability inside and out the file-upload.
This is very much required as currently the upload part has its own way to push the file. This makes the API unusable incase if the user choses to use APIs like custom interceptors that validate, enrich actual request before sending to server, such as this [which I happen to rewrite based based on an existing implementation]
Agree, but i think you have a misunderstanding on the how the td-file-upload works atm.. since its not binded to any service or way of pushing to the server at all.
Its (upload) event returns the selected file(s) (no server call done at all), and from there you can send it to the server any way you like. Its only called (upload) by name since its a representation of pressing an upload button, but the developer still has to do the call and provide that implementation (be it adding interceptors, validations or any service for that matter)
The reason we want to split it into 2 parts is to give more flexibility UI wise, and create more atomic components.
Thanks for the detailed explanation. My understanding was quite wrong.
Based on your explanation, I feel that upload is a bit misleading to begin with.
Here is my understanding of what user's expectations are
ngModel/formControl, so that this info can be retrieved later, when the user trigger actual server pushGiven the above requirements, I dont see a reason for the existence of upload event, just select should be good enough (gets triggered as soon as the user selects/drops file(s), which developer can optionally bind to) + component binding (which is required to know what files are selected, irrespective of whether user bound to select event or not).
You basically described the new td-file-input which we created a PR earlier today. https://github.com/Teradata/covalent/pull/339
I still dont get the reasoning behind having td-file-upload?