AngularJs ReferenceError: $http is not defined

前端 未结 3 1222
不思量自难忘°
不思量自难忘° 2020-11-29 21:22

I have the following Angular function:

$scope.updateStatus = function(user) {    
    $http({
        url: user.update_path, 
        method: \"POST\",
              


        
3条回答
  •  日久生厌
    2020-11-29 21:49

    Just to complete Amit Garg answer, there are several ways to inject dependencies in AngularJS.


    You can also use $inject to add a dependency:

    var MyController = function($scope, $http) {
      // ...
    }
    MyController.$inject = ['$scope', '$http'];
    

提交回复
热议问题