'smart-table'模块不可用

问题描述:

我正在尝试使用智能表。我按照这里提供的说明:http://lorenzofox3.github.io/smart-table-website/ 所以根据这些说明,我需要做的就是运行bower install angular-smart-table,然后添加模块angular.module('myApp',['smart-table']并添加到您的角度应用程序中。这里是我的角度应用:'smart-table'模块不可用

# pwd 
/var/www/html 
# cat meanVoyApp.js 
var app = angular.module("meanVoyApp", ['smart-table']); 

但现在当我打开我的标记我在浏览器控制台中看到这些错误:

Uncaught Error: [$injector:modulerr] Failed to instantiate module meanVoyApp due to: 
Error: [$injector:modulerr] Failed to instantiate module smart-table due to: 
Error: [$injector:nomod] Module 'smart-table' 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.3.14/$injector/nomod?p0=smart-table 

我没拼错,所以我想我“忘记”加载它。那么我如何加载它?我怎么知道它是否已经加载,而其他问题呢?

谢谢!

您是否记得在index.html中添加对脚本的引用?

<script src="[directoryOfModule]/smart-table.js"></script> 
+0

是的,工作。谢谢! –

智能表附带一些js文件。我认为你没有加载之前,你的meanVoyApp.js加载。使用chrome开发人员工具网络面板来识别java脚本是否正确加载。

使用下面的代码的app.js负载

<script src="http://lorenzofox3.github.io/smart-table-website/bower_components/angular-smart-table/dist/smart-table.js"></script> 

使用

bower install angular-smart-table --save 

和一些好的一饮而尽或咕噜构建工具配置(例如自耕农)之前,会自动将其添加到您的索引。 HTML。

+0

这有帮助,因为在我的情况下,bower做了一些额外的工作(在资产中添加了lib),这是强制性的,但是我手动在index.html中添加了 – Mindaugas

看看你的构建过程。

如果你使用ngBoilerplate Kickstarter的,则需要添加下列行: “供应商/角智能表/ DIST /智能table.min.js”

内部vendor_files build.config的部.js文件。