I want to understand below issue which i am facing . I have a form with formgroup in it . I have a multiselect tag in the html which consists of (select) = onSelect(event)
Now in ts file i am using value changes to the template refernce of the multiselect tag ! And also onSelect method
My html
<ds-multi-select>
#costcenter
[items] = “listofitems”
[label] = “labelkey”
[value] = “valuekey”
(Select) = “onselect($event)”
</ds-multi-select>
Inside a method in my ts file i have
this.form.get(“costCenter”).valuechanges.pipe().subsribe (costcheck
=> {
…..
});
Also have separate function
OnSelect(selectedItem:any)
{
IsSelected = SelectedItem.IsselectedItem
}
Now whenever i hit the dropdown list, the valuechanges is getting called first and then onSelect method. I want to use Isselected value from onSeelect function inside valuechanges. I want onSelect to be called first and use the valuechanges later.
I also tried to check in the valuechanges event if I could catch the checkbox is selected or not attribute but couldn't find anything !
Please help with the correct solution !