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.