Need help with promises?

Hello i’m trying to get how promises work could someone show me and example of calling 2 functions in sync one after one ? Sorry for such a newbie question:)

Okay so ive made this codepen and how can i call the addTwo after addOne synch?

You could call addTwo in your success callback and use the result parameter.
Then use the callback of addTwo to push the final result onto the scope.

But i think promises are overkill for synch operations. They should be used for asynch stuff.

$scope.addOne($scope.test).then(function (result) {
                    $scope.addTwo(result).then(function (result) {
                        $scope.test = result;
                    });
                }
            );

I mean i wanna to call function w8 when its done then call other and inside i got some cordova sqlcalls and wcf calls so it will call like functions in c# :smile: