My problem is that angular doesnt wait for the promises to be resolved.
as you can see in the inspect from the console, it prints that it didnt get the provider and skills object and just below that the promises return.

added below are the most relevant code parts in my opinion. I made the service using angulars library - $q and used the deferred, then and when options - as you can see in the service below.

Provider Service:

```
this.getProviderById = function (providersId) {
        // will hold backend provider of the provider with id = providersId
        var provider = undefined;
        // if provider object is not defined then start the new process to fetch it
        if (!provider) {
            // create deferred object using $q
            var deferred = $q.defer();

            // get provider form backend
            $http.get('http://localhost:3000/providers/getbyid/' + providersId)
                .then(function (result) {
                    console.log('provider by id result - ' + JSON.stringify(result.data));
                    // save fetched provider to the local variable
                    provider = result.data;
                    // resolve the deferred
                    deferred.resolve(provider);
                }, function (error) {
                    providers = error;
                    deferred.reject(error);
                });

            // set the provider object to be a promise until result comeback
            provider = deferred.promise;
        }
        return $q.when(provider);
    };

```

Provider Controller Definition:

```
 var vm = this;
    vm.getCurrentUser = getCurrentUser;
    function getCurrentUser(){
        console.log('returning current user from auth service');
        return authService.getCurrentUser();
    }
    vm.getProviderById = getProviderById;
    function getProviderById(providersId){
        providerService.getProviderById(providersId)
            .then(function onSuccess(providerResult){
                console.log('providerResult - ' + JSON.stringify(providerResult));
                $scope.provider =  providerResult;
            }, function onError(error){
                console.log('error getting provider by id - ' + error);
            });
    }

    vm.getProviderSkills = getProviderSkills;
    function getProviderSkills(providersId){
        providerService.getProvidersSkills(providersId).then(function onSuccess(resultSkills){
            console.log('resultSkills - ' + JSON.stringify(resultSkills));
            $scope.skills = resultSkills;
        }, function onError(error){
            console.log('error getting providers - ' + $scope.provider + ' - skills');
        });
    }

```

Provider Controller Usage:

```
  $scope.user = vm.getCurrentUser();
    if ($scope.user !== null && $scope.user !== undefined) {
        console.log('user - ' + JSON.stringify($scope.user));
    } else {
        vm.initUsersProvider();
        console.log('initiated users provider');
    }
    vm.getProviderById($scope.user.provider);
    if ($scope.provider !== null && $scope.provider !== undefined) {
        console.log('provider - ' + JSON.stringify($scope.provider));
    } else {
        console.log('didnt get provider object');
    }
    vm.getProviderSkills($scope.provider);
    if ($scope.skills !== null && $scope.skills !== undefined) {
        console.log('provider - ' + JSON.stringify($scope.skills));
    } else {
        console.log('didnt get skills object');
    }

```

Inspect Console Showing result of the picture above:

```
user - {"_id":"5835b06b975ace23244bf205","email":"iairbluer@gmail.com","password":"","fbuser":"5835b06a975ace23244bf204","provider":"5835b06f975ace23244bf206","admin":false,"__v":0}
ProviderRegisterController.js:14 providersId - 5835b06f975ace23244bf206
providerService.js:74 providersId - 5835b06f975ace23244bf206
ProviderRegisterController.js:110 didnt get provider object
ProviderRegisterController.js:117 didnt get skills object
ProviderRegisterController.js:122 no availability module found
ProviderRegisterController.js:124 no bio module found
providerService.js:83 provider by id result - {"_id":"5835b06f975ace23244bf206","bio":"","__v":2,"references":[],"availability":{"auto":true},"skills":["5835b220975ace23244bf208","5835b2ff975ace23244bf209"]}
ProviderRegisterController.js:17 providerResult - {"_id":"5835b06f975ace23244bf206","bio":"","__v":2,"references":[],"availability":{"auto":true},"skills":["5835b220975ace23244bf208","5835b2ff975ace23244bf209"]}
providerService.js:56 received skills from db - [object Object],[object Object]
ProviderRegisterController.js:27 resultSkills - [{"_id":"5835b220975ace23244bf208","topic":2,"description":"sdfsdf","price":45,"status":"PENDING","__v":0},{"_id":"5835b2ff975ace23244bf209","topic":1,"description":"ddfgdfg","price":45,"status":"PENDING","__v":0}]

```

Thanks, for all the help :)