angularjs - 模块 'moduleName' 不可用!您要么拼错了模块名称,要么忘记加载它

标签 angularjs

我是新的 Angular,我必须在我的项目中实现服务器端分页,所以我做了所有事情,就像在这个例子中所做的那样:
Server Side Pagination In Angularjs Tutorials

但我在我的网络浏览器控制台中收到这些错误:

GET 
http://*********/admin/css/bootstrap.min.css [HTTP/1.1 404 Not Found 1043ms]

GET 
http://*********/admin/css/bootstrap-theme.min.css [HTTP/1.1 404 Not Found 1385ms]

GET 
http://*********/admin/css/styles.css [HTTP/1.1 404 Not Found 1334ms]

GET 
http://*********/admin/lib/angular/angular.js [HTTP/1.1 404 Not Found 1384ms]

GET 
http://*********/admin/lib/dirPagination.js [HTTP/1.1 404 Not Found 1383ms]

GET 
http://*********/admin/app/app.js

and

Error: [$injector:modulerr] Failed to instantiate module angularTable due to:
[$injector:nomod] Module angularTable 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.module('myapp').controller(function() {
});

请注意,此代码不会创建名为 myapp 的模块,它只是引用现有模块。如果您尚未创建模块,则会发生您遇到的错误。

要创建模块,请执行此操作...
angular.module('myapp', []);

另外,不要忘记 HTML 中的 ng-app 指令...
<html ng-app="myapp">

当然,这假设您的脚本文件正在正确加载。根据您的问题,您的文件无法加载,因此 myapp 尚未创建也就不足为奇了。您应该检查您尝试加载的文件是否确实存在于您的服务器上。还要确保您知道哪个文件夹是您的 Web 服务器提供文件的根文件夹。这将帮助您获得正确的文件路径。

关于angularjs - 模块 'moduleName' 不可用!您要么拼错了模块名称,要么忘记加载它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36355409/

相关文章:

javascript - YouTube API v3 : Get all Channels and PlayLists for given User-name

javascript - 在 Controller 中调用 AngularJS 服务函数时出错?

javascript - 从 Angular 指令更新模型

javascript - 为什么这个 Angular Controller 会抛出 "Error: Unknown provider: nProvider <- n"?

jquery - 无法在 AngularJS 指令中检索 CSS 值

javascript - 如何检查某些东西是否在 ng-class 的数组中

angularjs - 验证 textAngular 文本长度

javascript - 如何在发送 angularj http 请求时显示加载消息

javascript - 错误 : Template parse errors: Can't bind to 'options' since it isn't a known property of 'chart'

angularjs - Protractor 控制台日志