Use ionic popup in function

I am trying to use the pushplugin for cordova and have the problem that the pushfunction that is defined by the ecb tag cannot find an other function that is in a factory. So my soloutin was to take the ecb function out of the factory and now it works! :) If there is an other solution please tell me!

Now I have got the problem that since my function that is called by the Google Cloud Messaing Service is not a part of my factory and I'am trying to use the $ionicPopup which is injected in the beginning.

Is there any way to inject it into my function so I can use it, or a way to get my ecb function back into my factory to solve the problem?

Here is my Code:

var services = angular.module('services', [])

services.factory('services', function ($window, serverAPI, $rootScope, $ionicPopup, $interval) {
    var pushNotification;

    enablePushNotification: function () {
        pushNotification = window.plugins.pushNotification;
        pushNotification.register(
            function successHandler(result) {
                console.log('result = ' + result);
            },
            function errorHandler(error) {
                console.err('error = ' + error);
            }, {
                "senderID": "ID",
                "ecb": 'onNotificationGCM'
            })

    }



})

function onNotificationGCM(e) {
    console.log(e)
    switch (e.event) {
    case 'registered':
        if (e.regid.length > 0) {
            console.log("Regid " + e.regid);
            serverAPI.insertPushId(UID, e.regid, function (result) {
                if (result < 0) {
                    console.error("Error callback insertPushId: " + result)
                } else {
                    window.localStorage.setItem('pushId', e.regid)
                }
            })
        }
        break;

    case 'message':
        if (e.payload.message == 'Be exited') {
            $ionicPopup.alert({
                title: 'Be excited!',
                template: 'Someone is seaching for you'
            })
        }
        break;

    case 'error':
        alert('GCM error = ' + e.msg);
        break;

    default:
        alert('An unknown GCM event has occurred');
        break;
    }

}

Thank you very much! :)