After making the Http Request and receiving the response from the first Service call, I then pass that response from the first service into the second service and receive the response back to the controller.
Now that I have the response, I need to find a way to access it in the controller.
app.factory('logHomeService', function () {
var getHomeService = function (LoginService, HomeService) {
return
{
LoginService.After("user", encodeURIComponent("pass"))
.then(function (response) {
debugger;
$stateParams.User = "admin";
var mydata = response.CT1SessionObj;
var DefaultModelObj = { cobj: mydata};
HomeService.pageLoad(DefaultModelObj)
.then(function (response) {
$rootScope.CT1SessionObj = response.mydata;
}, function (response) {
console.log("LoginService" + response.data);
alert(response.Message);
});
},
function (response) {
console.log("Home Service" + response.data);
return response.data;
});
return response.data;
};
};
return {
getHomeService: getHomeService
}
});
app.Controller('HomeController',function($scope,logHomeService)
{
this.logHomeService = logHomeService;
}
Now with this.logHomeService = logHomeService returning the method in the factory, I still need a way to extract the response result from the second service.
My goal is to return the home service response to the controller, with a console.log("Home Service" + response.data);