Services I, what's wrong with the code


#1

The code won't run and I can't figure out why?

app.factory('forecast', ['$http', function($http) {
return
$http.get('https://s3.amazonaws.com/codecademy-content/courses/ltp4/forecast-api/forecast.json')
.success(function(data) {
return data;
})
.error(function(err) {
return err;
});
}]);


#2

I have this same problem


#3

If the quote below is displaying the code as you wrote it, you need a space between return and $http.

So instead of being written like so:
return$http.get('https://s3.amazonaws.com/codecademy-content/courses/ltp4/forecast-api/forecast.json')
write it like this:
return $http.get('https://s3.amazonaws.com/codecademy-content/courses/ltp4/forecast-api/forecast.json')
Since they are showing as being on separate lines in your example, add a space after the return.


#4

instead of typing it, just copy and paste the code. it will work


#5

It's very strange lesson. It's said that we are using services, but in fact we are using factories.
In the code to this lesson no one word "service". So it has to be called factories)