I am trying to build a drop down with a few values.
However, on selecting a value, I want to make an API call that takes an id.
In my component.ts, I have an
Another solution would be,you can get the object itself as value if you are not mentioning it's id as value: Note: [value] and [ngValue] both works here.
In ts:
your_method(v:any){
//access values here as needed.
// v.id or v.name
}
Note: If you are using reactive form and you want to catch selected value on form Submit, you should use [ngValue] directive instead of [value] in above scanerio
Example:
In ts:
form_submit_method(){
let v : any = this.form_group_name.value.form_control_name;
}