TypeError: Cannot read property 'post' of undefined in ionic


#1

I am calling a service inside a function in my controller.js. but its giving me following error:My Ionic version is 1.1

TypeError: Cannot read property ‘post’ of undefined in ionic.

function updatePaymentStatus($ionicLoading,$http,payId,response){ alert('service calling..');

var apiUrl = 'http://148.251.158.141/EduboldPortalApp/eduboldportal/web/app_dev.php/api/';

         return $http.post(apiUrl+'student/result/term',{
             
                            studentId: '56456456466',
                            term: 'Term1'
                            
                        }).then (function (res){  alert(res);
                           
                            
                            if (res.data.ResponseCode == "1") {
                                  
                                        //$scope.showp("Message","Massage Send  successfully","Okay")
                                        //$state.go('dashboard')
                                } else if(res.data.ResponseCode == "0"){
                                    //$state.go('login')
                                }
                        })

}

updatePaymentStatus function get called as soon payment get successfully in my app.

any one have any idea about it.