Best solution would be: just expose a focus () method on the formControls. nativeElement returns a reference to the DOM element which can also come under debugElement as stated above.You can use it do actions such as click() event in test cases. Example: If you add a
to Hello Angular 10! Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Let's get started with angular elementref trigger click. To confirm you could run your test cases using ChromeHeadless browser. Next, we implement the AfterViewInit interface which provides our component with the ngAfterViewInit() life-cycle method that gets called after the view is intialized (This is important since we can query or modify the view only after it's intialized). In this first example, the first