0

I want to perform a click on an element of html page from its component class.

I have obtain the reference of the element in component class like this

@ViewChild('secondForm') input: ElementRef;

Now I want to perform a click on this input from a function lets say clickOnInput like this

public clickOnInput(){
 this.input.click() // I cannot find this function,
}

Is there any way or any other method to click on html elements from Angular's component class?

Nitish Kumar
  • 721
  • 1
  • 10
  • 26
  • https://stackoverflow.com/questions/36639486/angular2-manually-firing-click-event-on-particular-element – A.Akram Jul 30 '17 at 20:15
  • https://stackoverflow.com/questions/40103772/how-to-trigger-click-on-an-html-file-element-from-a-component-angular-2 – A.Akram Jul 30 '17 at 20:15

0 Answers0