ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278k

How to collect data from more select option drop down angul?

May 16 2020 3:10 AM
How to collect data from more select option drop down angul?
 
i create more derop down list dynamically but my problem is how
 
to collect all selected from drop down list created 
 
suppose i created two drop dow 
 
then i need to generate statment from selected as below 
 
dropdown1 = 'fruit'  and dropdown2='banana'
 
  1. onChange($event)  
  2.   {  
  3.     let textdata=$event.target.options[$event.target.options.selectedIndex].text;  
  4.     let statusdata:any = this.FilterBinddata.filter(s=>s.reportSource==textdata)[0].reportSource2;  
  5.     console.log("textdata is" + textdata)  
  6.     console.log("statusdata is" + JSON.stringify(statusdata))  
  7. }  
  1. <div class="form-group" style="display: flex; align-items: center;margin-top:10px;margin-left:20px;">  
  2.          <div *ngFor="let fil of FilterList"  style="padding-bottom: 10px;margin-right: 10px;">  
  3.            {{fil.controlName | slice:3:15}}     
  4.            <Select id="{{fil.controlName}}" (change)="onChange($event)" class="form-control" style="width:200px; margin-right:10px;">  
  5.              
  6.                  
  7.                 
  8.                <option value="0">-Select-</option>  
  9.                  <option *ngFor="let fil2 of this.FilterBinddata"  >  
  10.                    <div *ngIf="fil.controlName===fil2.filterName" >  
  11.                    {{fil2.reportSource}}  
  12.                  </div>  
  13.                  </option>  
  14.              
  15.                  
  16.          
  17.         
  18.      </Select>  
  19.        
  20.        <div>  
  21.        </div>  
  22.        
  23.        </div>  
 

Answers (1)