Skip to content

Instantly share code, notes, and snippets.

@jccrosby
Last active December 21, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jccrosby/6264585 to your computer and use it in GitHub Desktop.
Save jccrosby/6264585 to your computer and use it in GitHub Desktop.
Using $http instead of $resource for the EPL services
// Creating the service
factory('GetMajorEventsTimelineSvc', ['$q', '$http', '$window', function($q, $http, $window) {
return function() {
return {
get: function() {
var uri = 'http://overlays.nbcsports.com/services/lowttl/pl.asmx/GetMajorEventsTimeline';
var method = 'JSONP';
var params = {};
params.GameID = 694904;
params.callback = 'onGetMajorEvents';
var deferred = $q.defer();
$http({method:method, url:uri, params:params});
$window.onGetMajorEvents = function(data) {
deferred.resolve(data);
}
return deferred.promise;
}
}
}
}]);
// load call w/ response handlers
httpSvc.get()
.then(
function(data) {
// set data here
console.log(data);
},
function(data) {
// handle error here
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment