My goal is to utilize Angularjs for retrieving data from the USGS Earthquake feed. Unlike other APIs where adding ?callback=JSON_CALLBACK at the end of the URL allows Angular to process the data, the USGS feed does not support this option.
The URL I'm currently using is . When attempting to add ?callback=JSON_CALLBACK (e.g. ), it returns a dataset wrapped in a function called eqfeed_callback.
I am facing challenges in using this data effectively. Even though I have an eqfeed_callback function, it is not within scope which renders Angular's functionality ineffective.
Below is the current code snippet I am working with:
function QuakeCtrl($scope, $http) {
$scope.get_quakes = function() {
var url = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojsonp';
$http.jsonp(url)
}
}
function eqfeed_callback(data) {
return data;
}
I am looking for ways to either bring the data back into scope or enable Angular to internally use the eqfeed_callback function.