0

I want to pass the Response return by the $http.post to another controller. I tried so many ways and also searched on the internet, but i not reach to the point.

Function "evaluateScore()" inside the factory called by controller 'evalCtrl'. i'm getting the proper output of function inside the factory.

.factory('EvalServ', function($http){
    var evalFactory = {};
    evalFactory.evaluateScore = function(EvalData) {
        $http.post('api/universities',EvalData).then(function(Response){
            return Response;
        });
    }
    return evalFactory;
})

Below is my controllers which calls the function "evaluateScore()" in above service This controller is on Index.html page.

.controller('evalCtrl',function($scope,EvalServ){
    var app = this;


this.EvaluateForm = function(EvalData){

    EvalServ.evaluateScore(app.EvalData);

 }

});

I'm getting the proper output of function evaluateScore() in "evalctrl". I want to pass that function responded data to "resultCtrl" controller so that i can show the result on the result.html page.

Please tell me how to do that... And below is my result.html page controller. if anyone has any other idea to do that then write your answer.

.controller('resultCtrl',function($scope,EvalServ){
 // i want that $http.post responce data here...   

});

0 Answers0