I am accustomed to using the view child for certain cases where I want to handle DOM elements, for example when someone presses a submit button I disable it and also the cancel button or any other button that needs to apply the same thing.
To do this, I do something like this:
@ViewChild('submitButton') submitButton!: ElementRef<HTMLInputElement>;
@ViewChild('cancelButton') cancelButton!: ElementRef<HTMLInputElement>;
First I assign the view child to the DOM elements.
Second, when the function is called, I access its native element:
submit() {
this.submitButton.nativeElement.disabled = true:
this.cancelButton.nativeElement.disabled = true:
}