title: Angularjs TypeError: UserService.getCurrentUser.then is not a function at m.$scope.getCurrentUserId
body: <p>I have an Angular controller and an Angular service. From my controller, I'm calling to the service.There are two functions in my Service. First function works fine. But this problem occurs with the second one. Following is the code for the relevant function.</p>
  
  <pre><code>function getCurrentUser() {
      return $resource(_URLS.BASE_API + 'get_current_user' + _URLS.TOKEN_API + $localStorage.token).get().$promise;
  }
  </code></pre>
  
  <p>Following the code for calling that service's function from the controller,</p>
  
  <pre><code>//Get current user id
  $scope.getCurrentUserId = function() {
      ParentService.getCurrentUser.then(function(response) {
          if (response.query_status == "success") {
              $scope.userid = response.data.id;
              console.log('Value is: '+ $scope.userid);
          } else {
              $scope.userid = null;
          }
      }, function(error) {
          $scope.userid = null;
          console.log("Error : Failed to load user data...");
          console.log(error);
      });
  };
  </code></pre>
  
  <p>I can't figure out what the issue is since my first function works fine. So hope someone will help me to solve this issue.</p>