I'm using Angular 4. I'm trying to access one component's template element inside another component. The only thing I've found that works (illustrated below) is not very 'Angular'.
Component #1 (which contains the template):
@Component({
template: `...<input type="text" id="txtUserName" />`
Component #2 (which is getting the above component's template element value in a click event):
(<HTMLInputElement>document.getElementById('txtUserName')).value;
I've found countless snippets on ElementRef, ViewChild, etc., but none of them actually work for getting the template element's value. Does anyone know of an Angular 4 approach that accomplishes the same thing I'm doing above?