by @kodeazy
How to get selected value from select Tag using Angular (change) event
To get the selected option we have to add a function, which calls every time the drop down is changed using (change)
event
In app.component.html
add the below code
<select class='form-control' (change)="somethingChanged($event)">
<option>A</option>
<option>B</option>
<option>C/option>
</select>
After Selecting the Drop Down somethingChanged($event)
function is executed.
In app.component.ts
add the below code inside the AppComponent class
add the below code
export class AppComponent {
somethingChanged(data :any){
console.log(data.target.value);
}
}
Here data.target.value
gives the selected drop down value