In my MovieSearchCtrl controller class, I have a method called returnMovies(query)
that looks like this:
returnMovies(query): any {
return MovieSeat.MovieSearchService.getMovies(query);
}
Within the MovieSearchService service class, there is a function named getMovies(query)
defined as:
getMovies(query) {
let baseURL = "http://api.themoviedb.org/3/";
return this.$resource(baseURL + "search/movie?api_key=a8f7039633f2065942cd8a28d7cadad4&query=" + query + "&callback=angular.callbacks._0");
}
In order to utilize the data returned by the getMovies()
function within the MovieSearchCtrl constructor, I want to assign it to this.results
. How can I achieve this?