After switching my Angular 5.x template to Angular 6 using the guidance provided at https://update.angular.io/, I encountered an error in my constructor.
Typescript Error: TS2314: Generic type 'ElementRef<T, any>' requires 2 type argument(s)
Here's a snippet of my code:
import { Component, Input, Output, EventEmitter, ElementRef, HostListener } from '@angular/core';
@Component({
selector: 'sidebar',
templateUrl: './sidebar.component.html'
})
export class SidebarComponent {
@HostListener('document:click', ['$event'])
clickout(event) {
if(!this.eRef.nativeElement.contains(event.target)) {
this.hideMobileSidebar.emit(true);
}
}
constructor(private eRef: ElementRef) {
}
...
The error was not present in the previous version, Angular 5. What could have caused this change? I find it challenging to comprehend the documentation provided at https://angular.io/api/core/ElementRef.