Issue with navigator.notification.confirm not working when using angular


Im having an issue trying to use the navigator.notification.confirm. Im using it inside a factory of angular but it doesnt work.

angular.module('starter').factory('CerrarSesion', function ($state){

return {

onConfirm: function (buttonIndex){
  if (buttonIndex == 2){
    alert('Se esta cerrando la sesion');;

logOut: function() {
    'Está seguro que desea cerrar la sesión?',  // message
    onConfirm,              // callback to invoke with index of button pressed
    'Cierre de sesión',            // title
    'No,Sí'          // buttonLabels



It is showing “pressed!” with the regular alert but the navigator.notification.confirm is not working.

If i took it to another js file with no angular module and called it like i wasnt using angular it works. So i know the problem is when i use phonegap api inside angular.

I really appreciate if you could help me!.

Thanks a lot in advance!