I am working on a HTML file that includes a dropdown list:
<select>
<option *ngFor="let t of items" value="t">
{{ t }}
</option>
</select>
In addition to the dropdown list, there is also a submit button present on the same page:
<button type="button" (click)="selectedValue()" class="btn btn-info btn-sm">
Submit
</button>
My goal is to retrieve the value that the user selects from the dropdown list. I believe this value is stored in variable "t", and I want to pass it to a function like this:
selectedValue() {
// calling the updateValue function with the selected value
updateValue(t) { }
}
This process seems a bit complex to me. I am not sure where to start - how do I transfer the selected value from the HTML to the TypeScript file and then successfully call a function to update the value and receive a successful response (status code: 200) from an HTTP request.