Phonegap/Cordova Events Support


Ionic uses the devicereadyto initialize the AngularJS app. Is there any way to bind to the other Phonegap/cordova events ( inside our AJS app?


I contain them all in a separate phonegap-events.js file and reference it after phonegap.js in my index.html.

I’m sure there is a more AngularJS approach but this works for my requirements.

phonegap-events.js contents:

document.addEventListener("resume", onResume, false);
document.addEventListener("online", onOnline, false);
document.addEventListener("offline", onOffline, false);

function onResume() {

function onOnline() {
  document.getElementById('connection-warning').style.display = 'none';

function onOffline() {
  document.getElementById('connection-warning').style.display = 'block';


It actually works in an angular controller. I’ve tried Cordova’s resume and pause event. The others should work the same. deviceready might not work because I’ve seen Ionic removing the event listener, but haven’t verified that.

angular.controller('AppCtrl', function () {
  document.addEventListener("resume", onResume, false);
  document.addEventListener("pause", onPause, false);

  function onResume() {
    console.log('On Resume');

  function onPause() {
    console.log('On Pause');


How can i get the $scope on resume method? It is possible?
I need refresh a list inside a controller after on resume!