Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Function in Service that call function inside itself

$
0
0

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?
                }
            });
        }
    }
})

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>