Why triggering and simulation of file uploader button clicking from typescript code in html doesn't work? #1066
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have a button component in my
navbar.component.htmlas shown below. I would like to simulate and trigger clicking in buttonUploadfromnavbar.component.ts file. When I clickUploadbutton it automatically opens file selector for instance on my mac it is finder.Then I select the file and it is uploaded to the backend. I want to achieve the same action but using typescript code. So I just want to simulate as the user would click Upload button what will cause opening file selector and then all other activities will be the same as he would click button. Any ideas why it is not working? I did everything as was shown here.
In navbar.component.ts:
I tried also:
uploadFile():
In navbar.component.html: