微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

angularjs – 模块’moduleName’不可用!您要么错误拼写了模块名称,要么忘记加载它

我是新的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服务器从中提供文件的根文件夹.这将帮助您正确地获取文件路径.

原文地址:https://www.jb51.cc/angularjs/141201.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐