Wraps the Rotten Tomatoes API into a AngularJS service.
angular.module('app', ['ngRottenTomatoes'])
.config(function(rottenTomatoesProvider) {
rottenTomatoesProvider.setKey('YOUR_TOKEN');
});
Inject the service to perform request to the api and get the returning promise.
function AppCtrl(rottenTomatoes) {
rottenTomatoes.movie.info(ID).success(function(data) {
$scope.movie = data;
});
}
function AppCtrl(rottenTomatoes) {
// DVDs Directory
rottenTomatoes.topRentals();
rottenTomatoes.currentReleases();
rottenTomatoes.newReleases();
rottenTomatoes.upcomingDvds();
// Movies Directory
rottenTomatoes.boxOffice();
rottenTomatoes.inTheaters();
rottenTomatoes.opening();
rottenTomatoes.upcomingMovies();
// Movies Search
rottenTomatoes.search(query);
// Movie information
rottenTomatoes.movieInfo(id);
rottenTomatoes.movieReviews(id);
rottenTomatoes.movieCast(id);
rottenTomatoes.movieSimilar(id);
rottenTomatoes.movieClips(id);
}