[英]In which order should I import my Angular files?
Angular app.js Angular 应用程序.js
(function () {
angular
.module("myApp", [
'ngRoute',
'ui.tree',
'ngAnimate',
'ngMaterial'
]);
})();
On the index.html , the order of libraries import is:在index.html 上,库导入的顺序是:
I'm getting this error:我收到此错误:
Error: $injector:unpr Unknown Provider错误:$injector:unpr 未知提供者
The order should be:顺序应该是:
First import Angular ( angular.min.js
).首先导入 Angular ( angular.min.js
)。
Import Angular files: controllers, services, directives...导入 Angular 文件:控制器、服务、指令...
Import others JS files导入其他JS文件
The order between Angular files does not matter ( eg: you can import services before controllers ). Angular 文件之间的顺序无关紧要(例如:您可以在控制器之前导入服务)。
In your case, a solution could be:在您的情况下,解决方案可能是:
Note: I don't see any controllers in your files, don't forget it!注意:我在你的文件中没有看到任何控制器,不要忘记它!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.