ios - ionic app resume and pause -


i want app when comes form it's background state active state. understand according cordova documentation can code below , working.

// device apis available // function ondeviceready() {    document.addeventlistener("resume", onresume, false); }  // handle resume event //    function onresume() { } 

my app build ionic , downside of using code above work outside app module, can't trigger functions inside app module. found few code example on how should work inside app module, non of them working. see examples below.

$ionicplatform.on('resume', function(){     // rock on }); 

/

ionic.platform.ready(function() {     ionic.on('resume', function(){         //rock on     }, element); }); 

/

$ionicplatform.ready(function () {         document.addeventlistener("deviceready", function () {             document.addeventlistener("resume", function () {                 $timeout(function () {                     //rock on                 }, 0);             }, false);         });     }); 

am doing wrong forgetting something, hope can me this.
thanks!!

for ionic try following code, hopes helps

.run(function($ionicplatform) {      $ionicplatform.ready(function() {       document.addeventlistener("pause", function() {        //code action on pause       }, false);       document.addeventlistener("resume", function() {        //code action on resume       }, false); }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -