AngularJS NG重复在引导多选下拉列表多选、列表、AngularJS、NG

2023-09-13 03:00:41 作者:别等了他走了

我用引导多选下拉http://davidstutz.github.io/bootstrap-multiselect/ &安培;嵌入到AngularJS&放大器的子模板;让它用下面的函数运行:

I used Bootstrap Multiselect Dropdown http://davidstutz.github.io/bootstrap-multiselect/ & embed into the sub-template of AngularJS & let it run with the following function:

$scope.$on('$viewContentLoaded', function () {
    $(document).ready(function() {
        $('#example27').multiselect({
            includeSelectAllOption: true
        });
    });
});

我继续使用NG-重复打印此输入的内部选项中进行选择:

I continued using ng-repeat to print the inside options of this input select:

    <select id="example27" multiple="multiple">
        <option ng-repeat="list in lists" value="{{list.id}}">{{list.name}}</option>
    </select>

但是,当NG-重复在此输入选择,也没有工作和放大器;没有打印任何数据。任何人都知道如何解决这个问题,请帮助我!

But when ng-repeat is in this input select, it did not work & didn't print any data. Anybody knows how to solve this problem, please help me!!

推荐答案

如果您使用的引导,多选,你应该使用NG-选项属性@像user2598687答案。在这里,小提琴版,它与Firefox的工作:点击我的jsfiddle

If you use bootstrap-multiselect you should use ng-options attribute, like in @user2598687 answer. Here version of fiddle that works with firefox: click me to jsfiddle

<select class="multiselect" data-placeholder="Select Products" 
  ng-model="productSelection" ng-options="item.id as item.name for item in Products"
  multiple="multiple" multiselect-dropdown >
$scope.Products = [{id:1,name:"Apple"}, {id:2,name:"Banana"}, {id:3,name:"Carrort"}, {id:4,name:"Dart"}];