簡體   English   中英

ng-dropdown-multiselect 庫對我不起作用

[英]ng-dropdown-multiselect library not working for me

我發現這個很酷的庫可以用 + 來做下拉菜單,這里:http :

我正在關注示例,我的有這個:

<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>

當我在這里添加依賴項時:

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']);

現在它“有效”

呃,必須喜歡前端開發,哈哈

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM