我正在使用以下' MultiSelect' 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>
错误:
有人可以帮我说出我错在哪里吗?
答案 0 :(得分:4)
依赖关系:
AngularJS&gt; = 1.2,Lodash&gt; = 2,Bootstrap&gt; = 3.0
注意:确保将lodash.js添加到项目中,并确保使用Lodash的调节版本(不是lodash.underscore或lodash.compat
在加载angularjs-dropdown-multiselect之前添加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>
答案 1 :(得分:1)
我试过这个并为我工作
使用以下代码替换第180行angularjs-dropdown-multiselect.js
if ($scope.settings.dynamicTitle && $scope.selectedModel && ($scope.selectedModel.length > 0 || (angular.isObject($scope.selectedModel) && _.keys($scope.selectedModel).length > 0))) {
积分https://github.com/dotansimha/angularjs-dropdown-multiselect/pull/60/files
包含由库重新启动的以下依赖项 https://github.com/dotansimha/angularjs-dropdown-multiselect#dependencies