I am new to angular js and trying to use directives. I want to use $http in link function of directive. Below is my code
MyApp.directive('appItem', ['$http',function() { 
  return { 
    restrict: 'E', 
    scope: { 
      transaction: '=' 
    }, 
    templateUrl: 'js/directives/appItem.html' ,
    link: function($scope, $http, element, attrs) {
            $scope.process = function(trId) {
               $http({
                    method: 'PATCH',
                    url: 'http://myapp.domain.local/api/v1/items/'+trId+'.json'
                }).
               then(function successCallback(response) {
                console.log(response);
               });
            }
        }
  }
}]);
But it gives me error:
$http is not a function
 
     
    