Which of these code snippets can be used to refactor the below given code?
@Component({...}) export class AppComponent implements OnInit { @ViewChild('username') input: ElementRef<HTMLInputElement>; ngOnInit() { console.log(this.input); } }
Options
1.@Component({...}) export class AppComponent implements AfterViewInit { @ViewChild('username') input: ElementRef<HTMLInputElement>; ngAfterViewInit() { console.log(this.input); } } 2.@Component({...}) export class AppComponent implements OnInit { @ViewChild('username') input: ElementRef<HTMLInputElement>; ngAfterViewInit() { console.log(this.input); } } 3.@Component({...}) export class AppComponent implements OnInit { @ViewChildren('username') input: ElementRef<HTMLInputElement>; ngOnInit() { console.log(this.input); } } 4.None of these