How do I access the value property of an element in the component in Angular2?
In the Template:
<input #myInput (keyup.enter)="onInput(myInput)"/>
In the Component code:
import {ElementRef} from '@angular/core';
...
onInput(latLngInputElement: ElementRef) {
// I want to access the value property of the <input> element here, and
// modify it so that it is reflected back in the template.
I know that I can pass the myInput.value into the code, but I need the reference so that I can also use the function to update the .value property of the element.
I'd like to know if there is a way to do this that does not involve two way binding to a global variable, because I think it is cleaner to have as few globals as possible. Thanks!