# HTTP GET Calling Multiple times in AngularJS Factory

I have created the angular Factory to get the results from the PHP and calling only one time but when I see in the Network its calling multiple times as shown below and its taking lot of time to get the response from PHP

I have attached the screenshot of the Network Tab where I am seeing multicurl.php is called 3 times, Since it is very data I have to make sure its called only 1 time and once it loaded I need to use the same information in other function with Factory, Can you please help here

I have referred below Question but I couldn’t make it work

Network Tab

Angular JS Code

app.factory('ProductsService', function($http,$filter) {
function getProduct() {
return $http.get('multicurl.php').then(function(response) { //console.log(response.data); return response.data; }); } function modifyProduct() { return getProduct().then(function(rawData) { /*My Code */ }); } function executionFromCompany() { var executionByCompanyArray = []; return modifyProduct().then(function(lightData) { /*My Code */ }); } function releaseTestCount() { return executionFromCognizant().then(function(cognizantitems) { /*My Code */ }); } function valuesForTable() { return releaseTestCount().then(function(values) { /*My Code */ }); } function graphOne() { return releaseTestCount().then(function(values) { /*My Code */ }); } return { getProduct: getProduct, modifyProduct: modifyProduct, executionFromCompany: executionFromCompany, releaseTestCount: releaseTestCount, valuesForTable: valuesForTable, graphOne: graphOne }; }); app.controller('BarCtrl', function($scope, ProductsService) {
ProductsService.releaseTestCount().then(function(values) {
/*My Code */
});
});
app.controller('TableCtrl', function($scope, ProductsService) { ProductsService.valuesForTable().then(function(value) { /*My Code */ }); }); app.controller("LineCtrl", function($scope, ProductsService) {
ProductsService.getMonthlyCount().then(function(values) {
/*My Code */
});
});


Source: AngularJS