$http is not a function in link functions of directive
<p>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</p>

<pre><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);
               });
            }
        }

  }
}]);
</code></pre>

<p>But it gives me error:</p>

<pre><code>$http is not a function
</code></pre>