I know what the host element for a directive is the element in which the directive applies. But I don't understand what is the host element for a component.
My code is working, but I can't get how it works.
this is my code
@Component({
selector: 'ec-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HeaderComponent implements OnInit {
public size!: 's' | 'm';
public isAuth!: Observable<boolean>;
constructor(private router: Router, private store: Store) {
this.getSize();
}
public ngOnInit(): void {
this.isAuth = this.store.select(selectIsAuth);
}
**@HostListener('window:resize')
public onResize(): void {
this.getSize();
}**
private getSize(): void {
this.size = window.innerWidth < 1024 ? 's' : 'm';
}