Check condition in angularjs

Viewed 2045

Basically i have a factory

angular.module('app').factory('gService',gService);
function gService($filter, $window) {
    function confirmDialog(message, success, fail) {
        var confirmMessage = navigator.notification.confirm(
                message,
                onConfirm,
                '',
                [$filter('translate')('OK'), $filter('translate')('CANCEL')]
            );
        function onConfirm(index) {         
            return index === 1 ? success() : fail();
        }
        return confirmMessage;
    }
}

I want to check condition outside this factory, if the functions are executed or not

if(gService.confirmDialog.onConfirm){

}

this does not work. How do i check function which is executed in angular?

6 Answers
Related