angularjs - 无法加载 ngTable : 'Module ' ngTable' is not available! '

标签 angularjs ngtable

我正在尝试在我的应用程序中使用 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/

相关文章:

html - Bootstrap 响应表和按钮

javascript - 当元素在对象中重复时 ng-repeat 不起作用

angularjs - 如何检测 ionic 方向?

angularjs - 使用 $http.get 进行 ngTableParams 分页

angularjs - 如何在 Angular JS 的表格中在第 N 行之后显式添加行?

html - 将按钮添加到angularjs中的表头

javascript - Angular ngtable中带有组合框的过滤列

javascript - AngularJS:页面刷新时保留登录信息

javascript - Angularjs:在服务中加载数据然后将其加载到 Controller

angularjs - 使用d3.js svg clipPath不能在Angular中进行裁剪