How to call service function in a controller with AngularJS?
<p>I'm trying to call a function from a service in a controller but I get an error saying that the thing I'm calling isn't a function. I'm new to AngularJS so I'm not exactly sure what I'm doing wrong. So, what's the correct way to call a service function in a controller?</p>

<p>I'm trying to call <code>getCurrentUserInfo</code> in the <code>ProfileCtrl</code></p>

<pre><code>.service('AuthService', function($http, Backand){    
    function getCurrentUserInfo() {
        return $http({
            method: 'GET',
            url: baseUrl + "users",
            params: {
                filter: JSON.stringify([{
                    fieldName: "email",
                    operator: "contains",
                    value: self.currentUser.name
                }])
            }
        }).then(function (response) {
            if (response.data &amp;&amp; response.data.data &amp;&amp; response.data.data.length == 1)
                return response.data.data[0];
        });
    }
})

.controller('ProfileCtrl', ['$scope', '$ionicSideMenuDelegate', 'AuthService', function($scope, $ionicSideMenuDelegate, AuthService) {

  AuthService.getCurrentUserInfo().then(function(response){
   $scope.user = response.data.data;
});

//  function getCurrentUserInfo() {
//    AuthService.getCurrentUserInfo()
//    .then(function (result) {
//      $scope.user = result.data;
//    });
//  }

}])
</code></pre>