see this for a working example of (a general way) how to send data to and return data from a service - jsfiddle: https://jsfiddle.net/z5vd676x/ and copy of the code below. you can adapt it to make it more efficient for your application and follow best practices (i.e. promises, error handling, minification, etc):
var app = angular.module('myApp', []);
app.controller('LoginController', function($scope, LoginService) {
$scope.fullName = "Full name";
$scope.login = function(data) {
$scope.data =data; //store as $scope.data and pass it to the service :
$scope.fullName = LoginService.getFirstName($scope.data) + " " + LoginService.getLastName($scope.data);
};
});
//this is an example of a .service, you did not provide your code for this
app.service('LoginService', function() {
this.getFirstName = function (data) {
if (data === '123')
return 'John';
else
return 'Mike';
};
this.getLastName = function (data) {
if (data === '123')
return 'Winkle';
else
return 'Santos';
};
});
index.html (example use)
<div ng-app="myApp" ng-controller="LoginController">
<input type="text" ng-model="findName"> <!--bind the search text-->
<button type="button" ng-click="login(findName)">Search</button>
<!--show the initial value below and update it when the LoginService returns your data -->
<h3>Name: {{fullName}}</h3>
</div>