Function in Service that call function inside itself


#1

Hi there! I wonder if it is possible that a method of a service function like in my example calls a method inside itself. Like Alert AskYesNo can call showAlert function (method). I have try using this.showAlert for example. But sends an error message. I also have tried Alert.showAlert and the same.This is just an example, I have a more complex service function with the same problem. Can you help? thank you a lot :wink:

.factory('Alert',function($http, $ionicPopup){
    return {
        
        showAlert:function(title,template) {
            $ionicPopup.alert({title:title,template:template});
        },
        
        AskYesNo:function(title,template) {
            return $ionicPopup.confirm({title:title,template:template}).then(function(res) {
                if (res) {
                    Alert.showAlert("DoSomething","Here");//HOW CAN I CALL HERE?
                }
            });
        }
    }
})