I want to call web service on Load Page

I tried this, but my vairable is undefined, its work only i switch tabs container


function ($scope,$http) {
    
     

var indice = $scope.properties.clientIndice;
$scope.urlParts = {};
$scope.urlParts.param1 = indice;
$scope.urlParts.protocol = "http";
$scope.urlParts.domain = $scope.properties.hostnamePort;
$scope.urlParts.path = "morgans/clients";
 
$scope.makeUrl = function() {
return $scope.urlParts.protocol + "://" + $scope.urlParts.domain + "/" + $scope.urlParts.path + "/" + $scope.urlParts.param;
};
 
$scope.urlMorgans = "http://o"+ $scope.properties.hostnamePort + "/morgans/clients/" + $scope.properties.clientIndice + "/";
//$scope.urlMorgans = makeUrl();
 
$http({
method: 'GET',url: $scope.urlMorgans
}).then(function successCallback(response) {
$scope.properties.value = response.data;
}, function errorCallback(response) {
//alert(JSON.stringify("Call to retrieve organization information failed with - " + response.statusText));
$scope.message = "Erreur Survenue au moment de la Connexion";
}
);

 
    
}