title: Pass a variable to a service with AngularJS?
body: <p>I am building an app to track movies and their info, I am new to Angular, and I cant not really sure how to pass a variable to this service.
  I want the url to be a variable instead of hardcoded. whats the best way to do it?</p>
  
  <pre><code>tmdb.service('tmdbService', function($http, $q){
      var deferred = $q.defer();
  
      $http.get('https://api.themoviedb.org/3/movie/popular?api_key=jkhkjhkjhkjh').then(function(data){
          deferred.resolve(data);        
      });
  
      this.getMovies = function(){
          return deferred.promise;
      }
  });
  
  tmdb.controller("tmdbController", function($scope, tmdbService){
      var promise = tmdbService.getMovies();
      promise.then(function(data){
          $scope.movies = data;
          //  console.log($scope.movies);
      })
  }); 
  </code></pre>