AngularJs ReferenceError: $http is not defined

前端 未结 3 1224
不思量自难忘°
不思量自难忘° 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:57

    Probably you haven't injected $http service to your controller. There are several ways of doing that.

    Please read this reference about DI. Then it gets very simple:

    function MyController($scope, $http) {
       // ... your code
    }
    

提交回复
热议问题