奇怪的是,该模块在 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()”是在逃避 promise ,您应该改用 .then(),这里有一个解释它的链接 http://www.codelord.net/2015/05/25/dont-use-$https-success/
它是随机工作的,因为在你的案例中没有使用 promises
https://stackoverflow.com/questions/33534758/