I have encountered an issue while trying to call a service method from within the same service. Unfortunately, I am getting a "call to undefined function" error. To overcome this problem, I have implemented a workaround as demonstrated below. However, I am still eager to find out how I can call the service function without relying on the workaround. Can someone please assist me in identifying what I am overlooking here? Thank you.
.factory('TestSvc', function($http, $q) {
return {
login: function(){
var checkStatusFunction = this.checkstatus;
$http({ method:'POST',
url: url
responseType: 'json'
}).success(function(data,status,headers,config){
checkStatusFunction();
}).error(function(data,status,headers,config){
});
},
checkStatus: function(){
}
}
});