Before start How to Bind dropdown in angular 8 using material form.I think you’ve already set up a basic Angular project to work with select dropdown,
Now we are going to create a material form drop down.
Below is the code of My HTML
In this form data come in a array (months) from Ts component.in mat option *ngFor is us to iterate the array and the value shows in Dropdown. We will get the selected value from mat select over selection change .The selection change function called on Ts component which get value when the change event fires.
GetSalarymonths function is called on page load.Now its time to get value on select change.
(selectionChange)="SalaryslipByMonth($event.value)"
We will call this (SalaryslipByMonth) function on ts component.Lets see how it Looks Like.
Now we will check value in console.
No comments:
Post a Comment