1
Answer

Http service

hello Experts,
Below code is executed.There are two Http methods call on two different conditions..i want one http call for these two urls.
please help thank you.
 
Services.factory('DashboardService', function($http) {
return {
getDashboardData: function() {
var isWebBrowser = ionic.Platform.is('browser');
var isAndroid = ionic.Platform.isAndroid();
var isIOS = ionic.Platform.isIOS();
var url = "/api";
var data ="id=23&mobile=true&user_id=21&user_mongo_id=533aa5d1d2f72";
var url_final = url + '/dashboard/?' + data;
console.log('DashboardService Service Called')
if(isWebBrowser == true){
return $http({
method: 'GET',
url: url_final,
params: {id:23, user_id:21, user_mongo_id:'533aa5d1d2f72', mobile: 'true'}
}).then(function(response) {
return response;
})
}
if(isWebBrowser == true || isIOS == true ){
return $http({
method: 'GET',
url:"http://site.in/dashboard",
params: {id:23, user_id:21, user_mongo_id:'533aa5d1d2f72', mobile: 'true'}
}).then(function(response) {
return response;
})
}
}
}
})

Answers (1)