The rendering service is now deprecated (starting with Angular 4.x) The new Renderer2 service does not have invokeElementMethod. What you can do is get a link to an element like this:
const element = this.renderer.selectRootElement('#elementId');
And then you can use this to focus on this element as follows:
element.focus();
More on how selectRootElement works here :
EDIT:
If the element does not focus, the general problem is that the element is not ready. (for example: disabled, hidden, etc.). You can do it:
setTimeout(() => element.focus(), 0);
This will create a macro task that will be executed in the next turn of the virtual machine, so if you turn on the element, the focus will work correctly.
source share