本文介绍了AngularJS NG重复在引导多选下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用引导多选下拉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的工作:

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"}];

这篇关于AngularJS NG重复在引导多选下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 20:19