I have tried to set the value of #name1
as shown below.But it shows compile time error as shown below.Can you please tell me how to set the value for the text
component? Here I'm using one-way data bind and template-driven approach.
[ts] Property 'value' does not exist on type 'ElementRef'.
.html
<ion-input type="text" name="{{question?.name}}" #name1="ngModel" ngModel> </ion-input>
.ts
@ViewChild('name1') name1: ElementRef;
constructor(){
}
getAnswer(){
this.name1.value = 'Hello';//here it shows the above error
}