1. When would you use @ViewChild and what are the caveats?
@ViewChild gives you a reference to a child component, directive, or element in the same template. Use it for imperative access (focus an input, call a child method). It becomes available after view initialization (ngAfterViewInit). Avoid using it for data flow that can be expressed declaratively via Inputs/Outputs.
@ViewChild('inp') inp!: ElementRef<HTMLInputElement>;
ngAfterViewInit(){ this.inp.nativeElement.focus(); }