简体   繁体   中英

ng-repeat for chosen-select is not working

For me static option tags are working fine for multiselect but if use ng-repeat i am not getting list of options, If i remove the "chosen-select" list is coming. The below is working fine

in JS 
    var config = {
                          '.chosen-select'           : {},
                          '.chosen-select-deselect'  : { allow_single_deselect: true },
                          '.chosen-select-no-single' : { disable_search_threshold: 10 },
                          '.chosen-select-no-results': { no_results_text: 'Oops, nothing found!' },
                          '.chosen-select-rtl'       : { rtl: true },
                          '.chosen-select-width'     : { width: '95%' }
                        }
                        for (var selector in config) {
                          $(selector).chosen(config[selector]);
                        }
        }
In Html
     <select data-placeholder="Choose a Country..." class="chosen-select" multiple tabindex="4">     
                <option value="United States">United States</option>
                <option value="United States">India </option>
              </select>

If i replace this html code with ng-repeat it is not working.

 <select data-placeholder="Choose a Group" class="chosen-select" multiple tabindex="4">       
            <option ng-repeat="x in group" value="{{x.groupId}}">{{x.groupName}}</option>
          </select>

I am using chosen.jquery.js file also.

Add angular-chosen.min.js and the list(Category) is array value

<select  chosen multiple  tabindex="4" class="form-control"  ng-model="categoryid" ng-options="cat for cat in category" id="category" >    
    <option value=""></option>
</select>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM