I want to update input field by given name or id value with ts method with its id or name given with string.
I try diferent options with update ngModel ngValue but thats not it.
So i have an ipnut field
<div class="col-auto">
<input type="text" id="yproduct" name="yproduct" class="form-control" ngModel required>
</div>
And i change its value form service with:
this.stockInfoService.caller.subscribe(
data => {
this.caller = data
document.getElementById(this.caller).value = this.codeScan;
}
);
Everything works on html side and the field value shows inside input, but when i submit the form i have empty yproduct value !
{yproduct: ''}
documentobject, Angular should be the one handling the DOM. Also, have you tried using eitherTemplate driven formsorReactive forms?