Skip to content

Instantly share code, notes, and snippets.

@cironunes
Last active December 30, 2015 11:19
Show Gist options
  • Save cironunes/7822236 to your computer and use it in GitHub Desktop.
Save cironunes/7822236 to your computer and use it in GitHub Desktop.
sample service
'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