简体   繁体   English

ng-repeat for selected-select无法正常工作

[英]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. 对我来说,静态选项标签可以很好地用于多选,但是如果使用ng-repeat,我不会得到选项列表,如果我删除了“选择-选择”列表,那么我就来了。 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. 如果我用ng-repeat替换此html代码,它将不起作用。

 <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. 我也在使用selected.jquery.js文件。

Add angular-chosen.min.js and the list(Category) is array value 添加angular-chosen.min.js,列表(类别)为数组值

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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