how to trigger event click at input type=“file” by function in angular 2?

Source: https://stackoverflow.com/questions/38261859/how-to-trigger-event-click-at-input-type-file-by-function-in-angular-2

Pass the fileInput reference to triggerFile() and do the fileInput.click() there instead:
<input #fileInput type="file"  />
<button type="button" (click)="triggerFile(fileInput)">trigger</button>
triggerFile(fileInput:Element) {
  // do something
  fileInput.click();
}

Không có nhận xét nào:

StaticImage

  import React , { useEffect , useRef } from "react" import { StaticImage } from "gatsby-plugin-image" impor...