I want to use $http for send ajax request , I write this code but i get error
Error: $http is not defined
I put this code in run
app.run(['$rootScope','$location','$timeout','$http', function ($rootScope,$location,$timeout,$http) {
$rootScope.getMember = function(val){
var persons = $rootScope.selectPerson;
if(persons.length == 0)
persons = null;
return $http({
url: 'projectTask/GetMemberForFreeTask',
method: "POST",
data: $.param({'searchStr':val,'selectedPerson': persons}),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
})
.then(function(response) {
for(var i = 0; i<response.data.length; i++){
response.data[i]['first_name'] = response.data[i]['first_name']+' '+ response.data[i]['last_name']
}
$rootScope.states = response.data;
return response.data
}
);
}
}])