locked
Blank white space display on select option drop down although it bind data correctly? RRS feed

  • Question

  • User696604810 posted

    I create dynamic drop down on angular 7 on run time but my problem is when open select option it show

    white space on select option although it bind data correctly and fill correctly but my issue

    How to remove blank white space when i make bind to data ?

    Here below i create drop down dynamically with name and fill it

    <div class="form-group" style="display: flex; align-items: center;margin-top:10px;margin-left:20px;">  
             <div *ngFor="let fil of FilterList" style="padding-bottom: 10px;margin-right: 10px;">  
               {{fil.controlName | slice:3:15}}     
               <Select id="{{fil.controlName}}" (change)="onChange($event)" class="form-control"  
                 style="width:200px; margin-right:10px;" >  
    
    
    
                 <option value="0">-Select-</option>  
    
                 <option *ngFor="let fil2 of this.FilterBinddata" >  
                   <div *ngIf="fil.controlName===fil2.filterName ">  
                     {{fil2.reportSource}}  
                   </div>  
                 </option>  
    
    
    
    
               </Select>  
    
               <div>  
               </div>  
    
             </div>  
    
           </div> 

    see image below 

    http://www.mediafire.com/view/96lkuvvb1fq64va/blank_drop_down.png/file

    Tuesday, May 19, 2020 2:23 AM

Answers

  • User-474980206 posted

    a <div> Is not valid inside an <option>. Don’t know if angular has a dummy tag to use in this case like react's <></>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 19, 2020 2:54 PM

All replies

  • User-474980206 posted

    a <div> Is not valid inside an <option>. Don’t know if angular has a dummy tag to use in this case like react's <></>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 19, 2020 2:54 PM
  • User303363814 posted
    <option *ngFor="let fil2 of this.FilterBinddata.filter(d => d.filterName === fil.controlName" >
       {{fil2.reportSource}}  
    </option>  

    Thursday, May 21, 2020 5:41 AM