title: invokeElementMethod in Renderer2 angular
body: <p><strong>Context</strong> Angular project <br/>
  I have the following snippet:</p>
  <pre><code>export class OnlyNumberDirective {
    constructor(private _el: ElementRef,private renderer:Renderer2) {
    }
    @HostListener('input', ['$event']) onInputChange(e) {
      this.renderer.invokeElementMethod(this._el.nativeElement, 'dispatchEvent', [event]);
    }
  }
  </code></pre>
  <p>it uses Renderer, but it is deprecated and now we have Renderer2? <br/>
  What is the alternative to <code>invokeElementMethod</code> method in <code>Renderer2</code>?</p>