I want to take the input field value each time a letter is added/changed/deleted so I'm using the jquery to trigger it. but I don't know how to save this value.
in the html:
<form [formGroup]="searchForm">
<input id='myTextbox1' type='text'/>
</form>
in the ts file:
searchString:string;
searchForm: FormGroup;
ngOnInit(){
this.searchForm = new FormGroup({
'str':new FormControl(null)
})
/
$('#myTextbox1').on('input', function() {
// i tried this:
this.searchString = this.searchFrom.controls['str'].value
});
}
but controls weren't read from the form.
I just want to save the value of the input field in the searchstring variable and change it each time it changes. please help me.