简体   繁体   English

无法加载ngTable:'模块'ngTable'不可用!'

[英]Can't load ngTable: 'Module 'ngTable' is not available!'

I am trying to use ngTable in my app, and I do the following steps: 我想在我的应用程序中使用ngTable,并执行以下步骤:

1) import ngTable css file 1)导入ngTable css文件

2) import ngTable.js file 2)导入ngTable.js文件

3) add 'ngTable' to my angular.module('app', [xxx,yyy, 'ngTable'] like i've done for countless other libraries 3)将'ngTable'添加到我的angular.module('app',[xxx,yyy,'ngTable'],就像我为无数其他库做的那样

4) copy paste example code in my controller (and inject 'ngTableParams') 4)在我的控制器中复制粘贴示例代码(并注入'ngTableParams')

Result: when I try to load the page I get: 结果:当我尝试加载页面时,我得到:

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.

I have looked around but haven't found anything. 我环顾四周但没找到任何东西。 I can't seem to understand why this wouldn't work... I would appreciate any input. 我似乎无法理解为什么这不起作用......我将不胜感激。

I got the same error till I start loading ngTable after loading angular itself. 我得到了相同的错误,直到我加载角度本身后开始加载ngTable

Below is a snippet from my index.html to highlight the solution. 下面是我的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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM