I've seen https://stackoverflow.com/a/36639596/6656422 this works for buttons but not ngAfterViewInit.
In this plunker https://plnkr.co/edit/p4jsdPR9varhV9ihUhO5?p=preview fileInputElement.click();
opens the browser file prompt when called from the button click but not from ngAfterViewInit
even though fileInputElement
is defined.
Edit: I'v tried NgZone.run() and setTimeout(), without luck.