Walberg Walberg - 1 year ago 94
AngularJS Question

Angular JS Uncaught Error: [$injector:modulerr] uncaught error

I am making weather forecast web app using angular js.
Below is my little piece of code.

var myApp = angular.module("myApp", ["ngRoute", "ngResource"]);



templateUrl : 'pages/home.htm',
controller : 'homeController'

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 =
callback : "JSON_CALLBACK" }, {get : {method : "JSONP" }});
//below is line 41
$scope.weatherResult = $scope.weatherAPI.get({ q: $scope.city, appid: 9fc927759b42ed332b58471398219df0});


I am getting two errors:

Uncaught SyntaxError: Unexpected identifier app.js:41

Uncaught Error: [$injector:modulerr] angular.js:38 .

I have added every possible function, but still its getting error..
Can someone help me out with this.

Answer Source

This: appid: 9fc927759b42ed332b58471398219df0

Should be: appid: '9fc927759b42ed332b58471398219df0'

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download