Angular JS未捕获错误:[$injector:modulerr]未捕获错误
Angular JS Uncaught Error: [$injector:modulerr] uncaught error
我正在使用angular js制作天气预报web应用程序。下面是我的一小段代码。
var myApp = angular.module("myApp", ["ngRoute", "ngResource"]);
myApp.config(function($routeProvider){
$routeProvider
.when('/',{
templateUrl : 'pages/home.htm',
controller : 'homeController'
})
.when('/forecast',{
templateUrl : 'pages/forecast.htm',
controller : 'forecastController'
})
});
myApp.service("cityService", function(){
})
myApp.controller("homeController", ['$scope','cityService', function($scope,cityService){
$scope.city = cityService.city;
$scope.$watch('city', function(){
cityService.city = $scope.city;
});
}]);
myApp.controller("forecastController", ['$scope','$resource','cityService', function($scope,$resource,cityService){
$scope.city = cityService.city;
$scope.weatherAPI =
$resource("http://api.openweathermap.org/data/2.5/weather",{
callback : "JSON_CALLBACK" }, {get : {method : "JSONP" }});
//below is line 41
$scope.weatherResult = $scope.weatherAPI.get({ q: $scope.city, appid: 9fc927759b42ed332b58471398219df0});
console.log($scope.weatherResult);
}]);
我有两个错误:
Uncaught SyntaxError: Unexpected identifier app.js:41
Uncaught Error: [$injector:modulerr] angular.js:38 .
我已经添加了所有可能的函数,但仍然会出错。。有人能帮我解决这个问题吗。
此:appid: 9fc927759b42ed332b58471398219df0
应为:appid: '9fc927759b42ed332b58471398219df0'
相关文章:
- 错误:$injector:modulerr模块错误(我的第一个SPA应用程序)
- 错误:$injector:modulerr加载图像时模块处于角度
- 未捕获的错误: [$injector:modulerr] http ..(使用纯 HTML)
- 未捕获的错误:使用 ng-repeat 时出现 [$injector:modulerr]
- 未捕获的错误: [$injector:modulerr] - 角度 ng-include
- Angularjs未捕获错误:迁移到V1.3时出现[$injector:modulerr]
- 未捕获错误:[$injector:modulerr](新手)
- AngularJS错误:$injector:modulerr我的浏览器窗口中出现模块错误
- 获取未捕获错误:anuglar.js中的[$injector:modulerr]
- Angular应用程序无法安装,原因是出现错误:[$injector:modulerr]
- AngularJS 1.3 - 错误:错误:modulerr 模块错误(使用 ng-view,$routeProvide
- AngularJS - $injector:modulerr 模块错误在 angular.js:36.
- 未捕获的错误: [$injector:modulerr] 无法实例化模块 toastr
- 角度 JavaScript 缩小导致错误:$injector:modulerr 模块错误
- Angular js 未捕获错误:[$injector:modulerr] 匿名函数
- AngularJS : 未捕获错误: [$injector:modulerr] 使用 angularJS 的更新版本时
- Angular 脚本中的控制器错误 - [$injector:modulerr]
- AngularJS 0x800a139e - JavaScript 运行时错误:[$injector:modulerr]
- 未捕获的错误: [$injector:modulerr] 由于以下原因,无法实例化模块 myApp: 错误: [$inj
- AngularJS:未捕获错误:带有firebase的[$injector:modulerr]