If I use import { Renderer2 } from '@angular/core'; in my shared.module in angular 4,
why can't I also add it in the import array such as:
@NgModule({
imports: [
Renderer2,
...
]
Adding it in the import gives an error. Here is why I need Renderer2:
myComponent.html (part of my shared.module):
<input #searchElem type="text">
myComponent.ts
constructor(private renderer: Renderer2) {
}
const element = this.renderer.selectRootElement('#searchElem');
setTimeout(() => element.focus(), 0);
This is done to be able to set the focus of an element.