angular.js:2262 Uncaught Err[$injector:nomod] Module 'testApp' is not available!

angular.js:2262 Uncaught Error: [$injector:nomod] Module 'testApp' 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.
http://errors.angularjs.org/1.6.4/$injector/nomod?p0=testApp
    at angular.js:66
    at angular.js:2262
    at ensure (angular.js:2183)
    at Object.module (angular.js:2260)
    at index.js:3





解决方案:
1、清除浏览器缓存
2、在index.html中引用app.js的位置与其他js逻辑代码的位置顺序搞反了,不论如何一定要先引用app.js。  这个文件是引用路由,当先引其他js文件时候表示路由还没有被加载,这时候这些js代码的第一句,angular.module('testApp')中是没有路由的,所以报错。完整的路径是
angular.module('testApp',[])

猜你喜欢

转载自936606539.iteye.com/blog/2377818