我正在尝试在我的应用程序中使用 ngTable,并且执行以下步骤:
1) 导入 ngTable css 文件
2)导入ngTable.js文件
3)将“ngTable”添加到我的 angular.module('app', [xxx,yyy, 'ngTable'] 就像我对无数其他库所做的那样
4)将示例代码复制粘贴到我的 Controller 中(并注入(inject)“ngTableParams”)
结果:当我尝试加载页面时,我得到:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module ngTable due to:
Error: [$injector:nomod] Module 'ngTable' 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.
我环顾四周,但没有发现任何东西。我似乎无法理解为什么这不起作用...我将不胜感激任何意见。
最佳答案
在加载 Angular 本身后开始加载 ngTable
之前,我遇到了同样的错误。
下面是我的 index.html
中的一个片段,用于突出显示解决方案。
<script src="web/vendor/bower_components/angular-1.7.2/angular.min.js"></script>
<script src="web/vendor/bower_components/angular-1.7.2/angular-route.min.js"></script>
<link rel="stylesheet"; href="https://unpkg.com/ng-table@3.0.1/bundles/ng-table.min.css">
<script src="https://unpkg.com/ng-table@3.0.1//bundles/ng-table.min.js"></script>
关于angularjs - 无法加载 ngTable : 'Module ' ngTable' is not available! ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30312052/