I want to send data from an input field to component in order to retrieve subsequent data, if i bind the data to the value attribute it works as i want but i am unable to submit the form as the value bound value is not whats needed at the back end. this is my code sample
component.ts
fetchProductTypeForCategory(event) {
let category = event.srcElement.attributes.value || event.currentTarget.value;
this.productTypeSrv.fetchProductTypesParam(category)
.subscribe(res => {
this.productTypes = res;
}, err => {
console.log(err);
})
}
component.html
<select class="form-control" [formControl]="subCategoryForm.controls['l1category']" (change)="fetchProductTypeForCategory($event)">
<option *ngFor="let item of categorys" [value]="item.id">{{item.name}}</option>
<!-- <option *ngFor="let item of categorys" [value]="item.slug">{{item.name}}</option> --> // need this in order to submit the form
</select>
how can i bind the item.id
to a different input attribute and use it in my (change)="fetchProductTypeForCategory($event)"
call?