Use ionicPopup.alert in push.on - phonegap-push-plugin


I have implemented push notification inside my ionic app using phonegap-push-plugin.
Everything working fine except in the push.on (‘notification’.
The default code include a simple alert(); when a notification is received. Which not really sexy.
I would like to use ionicPopup. But can’t manage to make it work.
I always get an error like alert undefined…

I am new to Angular so maybe this is not the right way.
In my app.js I have the push notification code:

push.on('notification', function(data, $ionicPopup) { $ionicPopup.alert({ title: data.title, template: data.message }); });

Nothing happens here, an error undefined.
It is working if I use alert(data.message).

Do I need to create a controller, a service ? And trigger it in that push.on function ? How to do that if this is it?
Any help would be great.

Best regards,


Best regards,