Created
August 6, 2013 20:13
-
-
Save alejandroiglesias/6168183 to your computer and use it in GitHub Desktop.
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
angular | |
.module('api', ['$http']) | |
.constant('API_URL', '/api/') | |
.factory('getInitializationData', function () { | |
//since $http.get returns a promise, | |
//and promise.then() also returns a promise | |
//that resolves to whatever value is returned in it's | |
//callback argument, we can return that. | |
return $http | |
.get(API_URL + 'action/initalize') | |
.then(function (result) { | |
return result.data; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment