TypeError: $ http is not a function

0

Script:

app = angular.module("app",[]);

app.controller("controlador", ["$scope", function($scope, $http){
$scope.items = [];

$scope.submitForm = function() {
        // Posting data to php file
        $http({
          method  : 'POST',
          url     : 'http://localhost/nfe/admin/nfephp-master/exemplos/NFe/4.00testaMakeNFe.php',
          data    : $scope.items, //forms user object
          headers : {'Content-Type': 'application/x-www-form-urlencoded'} 
         })
}]);

Form:

<form ng-submit="submitForm()">
 ...
</form>

Error:

What might be causing this error?

    
asked by anonymous 04.01.2017 / 16:08

1 answer

6

You're missing your import declaration:

app.controller("controlador", ["$scope", "$http", function($scope, $http){
    
04.01.2017 / 16:25