Javascript AngularJS错误:[$injector:nomod]

Javascript AngularJS错误:[$injector:nomod],javascript,angularjs,Javascript,Angularjs,奇怪的是,这个模块在Firefox中完全可以加载 在Chrome中,模块有时会加载(在刷新打开和关闭时),并且似乎是出现以下控制台错误的唯一浏览器 错误:[$injector:nomod]模块“myApp”不可用!您要么拼错了模块名,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数 var myApp = angular.module('myApp', []); function MyController($scope, $http){ $http.get("http://

奇怪的是,这个模块在Firefox中完全可以加载

在Chrome中,模块有时会加载(在刷新打开和关闭时),并且似乎是出现以下控制台错误的唯一浏览器

错误:[$injector:nomod]模块“myApp”不可用!您要么拼错了模块名,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数

var myApp =  angular.module('myApp', []);
function MyController($scope, $http){
    $http.get("http://localhost/json").success(function(response){
        $scope.customers = response;
    });
});
myApp.controller('MyController', MyController);`
我认为“.success()”是在逃避承诺,你应该使用.then(),这里有一个链接来解释它


它是随机工作的,因为在您的案例中没有使用承诺

您是否在Javascript上使用任何缩小/丑化?我将再次检查以确保,但我确实相信我在我的gulp.js文件中注释掉/禁用了它。