[AngularJS]多选插件-AngularJs-工作不正常

发布时间: 2017/4/16 21:11:37
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

我使用 Angular.js 后 '选' 插件。我认为我正确使用代码,仍然我只相处错误网页而不任何下拉列表。

使用的插件︰

http://dotansimha.github.io/angularjs-dropdown-multiselect/#/

HTML:

<html>
<head>
    <!-- CSS files --> 
    <link rel="stylesheet" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"> 
    <!-- Script files --> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.1.2/ui-bootstrap-tpls.min.js"></script>
    <script src="angularjs-dropdown-multiselect.min.js"></script> 
</head>
<body ng-app="myApp" ng-controller="myCtrl"> 
<div ng-dropdown-multiselect="" options="listOptions" selected-model="list"></div>
<script>
//module declaration
var app = angular.module('myApp',['ui.bootstrap','angularjs-dropdown-multiselect']);
//controller declaration
app.controller('myCtrl',function($scope){
    $scope.list = []; 
    $scope.listOptions = [ 
        {id: 1, label: "David"}, 
        {id: 2, label: "Jhon"}, 
        {id: 3, label: "Danny"}
    ];
});
</script> 
</body> 
</html> 

错误︰

enter image description here

有人能帮我出来告诉我在哪里错了吗?

解决方法 1:

依赖项︰

AngularJS > = 1.2,Lodash > = 2, Bootstrap > = 3.0

注意︰ 请确保将 lodash.js 添加到您的项目,并确保您使用规范版本的 Lodash (不 lodash.underscore 或 lodash.compat

在加载 angularjs-下拉-多选前添加 lodash CDN:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.5.1/lodash.js"></script>
    <script src="angularjs-dropdown-multiselect.min.js"></script>
赞助商