A problem of passing parameters in angularJS service

see a question about angularJS passing parameters on sf, link here

the code is as follows:

var app = angular.module("demo.controllers", []);
//url
app.factory("Path" , function(){
    return {
        main_request_url: "http://0.0.0.0:3001/apis/v1_1/"
    }
});

app.factory("MediaResource" , ["$http" , "Path" , function($http , Path){

    return {
        //callback 
        all_of_media: function(call_back_param){
            //
            $http({
                url: Path.main_request_url+"/media.json" , 
                method: "get", 
                headers: {
                    "Content-Type": undefined
                }
            }).then(function(data){
                //callback
                call_back_param(data);
            });
        }
    }

}]);

app.controller("MainCtrl" , function($scope , MediaResource){

    //callback
    MediaResource.all_of_media(function(params){
        //$scope 
        $scope.results = params.data;

    });

});

among them, params.data, can be done directly by call_back_param (data),. I don"t quite understand why it is possible to do so.

Feb.28,2021

call_back_param is a parameter of all_of_media . It is a function
that is called after the request and passes the requested data to this function

call_back_param(data);

and you pass, call MediaResource.all_of_media to

function(params){
        //$scope 
        $scope.results = params.data;

    }

is passed to it as a parameter, that is,

defined above
call_back_param
Menu