ng-dropdown-multiselect库不适用于我

时间:2017-11-14 03:06:45

标签: javascript html angularjs twitter-bootstrap-3 ng-dropdown-multiselect

我发现这个很酷的库可以使用 + 进行下拉菜单,在这里: http://dotansimha.github.io/angularjs-dropdown-multiselect/docs

我正在关注这些示例,我在

中有这个
<div ng-dropdown-multiselect="" options="stringData" selected-model="stringModel" extra-settings="stringSettings">
</div>

这在我的控制器中:

$scope.stringData = ['a', 'b', 'c'];

$scope.stringModel = [];

$scope.stringSettings = {
  template: '{{option}}',
  smartButtonTextConverter: function(skip, option) {
    return option;
  },
};

但是,绝对没有任何内容呈现给页面。 :(

任何人都知道可能出现什么问题?

我已按此顺序加载

<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="lib/angular/angular.js"></script>
<script type="text/javascript" src="lib/angularjs-dropdown-multiselect/dist/src/angularjs-dropdown-multiselect.js"></script>

2 个答案:

答案 0 :(得分:2)

当我在这里添加依赖项时:

angular.module('app', ['ui.router', 'ngAnimate', 'ngSanitize', 'ngDropdownMultiselect']);

我收到此错误:

jquery.min.js:2 Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module ngDropdownMultiselect due to:
Error: [$injector:nomod] Module 'ngDropdownMultiselect' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.6.1/$injector/nomod?p0=ngDropdownMultiselect

所以我检查了文档(再次),它说要使用它而不是

angular.module('app', ['ui.router', 'ngAnimate', 'ngSanitize', 'angularjs-dropdown-multiselect']);

现在它&#34;工作&#34;

嗯,得爱前端开发lol

答案 1 :(得分:0)

var app = angular.module('app', [
    'ngAnimate',
    'ui.select',
    'ngSanitize',
    'ui.router',
    'ui.bootstrap',
    'ui.jq',
    'app.directive.voucherView',
    'abp'
]).filter('angularjs-dropdown-multiselect', function () { });