0

我想使用bootstrap-multiselect和require.js。 我在垫片中添加了以下几行:使用bootstrap-multiselect和require.js

shim: { 
bootstrap : { 
      deps: [ 'jquery', 'jquery_ui'] 
     }, 
bootstrap_multiselect: { 
      deps:['jquery', 'jquery_ui', 'bootstrap'], 
      exports: 'multiselect' 
     } 
} 

这不起作用。 我得到以下异常:

"TypeError: $(...) multiselect is not a function"

以下线 -

$('#SomeDiv').multiselect({

有谁知道什么是出口增加,使这项工作?

我也更新了此链接中的引导,多选文件: https://github.com/davidstutz/bootstrap-multiselect/pull/665/files

我觉得我做错了什么垫片中的文件。

+0

后,我想你需要更何况这里的出口应该有名称为“多选”无全局变量。 只是想知道,你可以请检查你的路径在require.config你指向的位置bootstrap_multiselect.js文件? – Nitesh

+0

嗨,路径是正确的,但我找到了答案! – user2549980

回答

0

托管解决这个错误,我改变

define(['jquery'], function($){//multiselect js here} 

define(['jquery', 'bootstrap_multiselect'], function($){//multiselect js here} 
+0

嗯...是的。如果你不加载它,你将无法使用它。 – Louis