Last active
August 29, 2015 14:27
-
-
Save mbranicky/875ce1741b286cca9b81 to your computer and use it in GitHub Desktop.
Service (basic examples)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}); | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('places', ['$http', function($http) { | |
return $http.jsonp('https://en.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=5000&gscoord=40.741934%7C-74.004897&gslimit=30&format=json&callback=JSON_CALLBACK').success(function(data) { | |
return data; | |
}) | |
.error(function(err) { | |
return err; | |
}); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment