Last active
December 30, 2015 11:19
-
-
Save cironunes/7822236 to your computer and use it in GitHub Desktop.
sample service
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
'use strict'; | |
angular.module('myApp.services', []) | |
.value('version', '0.1') | |
.constant('API_KEY', 't5vzuyfb49c2sd56sjz4bc2p') | |
.factory('$rtmFactory', function($http, API_KEY){ | |
var countries = [ | |
{name:'USA', code:'us'}, | |
{name:'UK', code:'uk'}, | |
{name:'France', code:'fr'} | |
]; | |
return { | |
getCountries: function() { | |
return countries; | |
}, | |
getMovies: function(code) { | |
return $http.jsonp('http://api.rottentomatoes.com/api/public/ ' + | |
'v1.0/lists/movies/box_office.json?limit=10&country=' + | |
code + '&callback=JSON_CALLBACK&apikey=' + API_KEY); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment