This is my function:
$scope.saveManualResendDraft = function(todo) {
    if ($scope.editMode) {
        updateStartJobManual();
        byeSendManualInputDirectly();
    } else {
        console.log('bye');
    }
};
I have two functions updateStartJobManual() and byeSendManualInputDirectly().
I want to complete first function fully then i need to move to second, How to do? is it possible to do using promises? I need some piece of code.
function byeSendManualInputDirectly() {
    if ($window.confirm("Do you want to send this messages?"))
        addProfSms();
    else
        console.log('no');
}
function addProfSms() {
    $http.post('/api/sendprofsms', $scope.draft).then(function(response) {
        swal("Good job!", "Message sended!", "success")
        //  $state.reload();
    });
}
function updateStartJobManual() {
    $http({
        method: 'POST',
        url: '/api/updatestartjobmanual',
        data: $scope.draft
    }).then(function(response) {
        $scope.currentItem = response.data;
        $scope.todos[$scope.currentItemIndex] = response.data;
        $scope.editMode = false;
        console.log('draft:', response.data);
        $state.reload();
        // toastr.success('Updated Successfully');
    }, function(response) {
        console.log('error');
    });
}
 
     
    