Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Usic Ionic instance somewhere else

$
0
0

@eldy wrote:

.run(function($ionicPlatform, $http,config) {
$ionicPlatform.ready(function() {

var device_token = localStorage.getItem('device_token');
if(!device_token){

  var push = new Ionic.Push({
    "debug": true
  });

  push.register(function(obj) {
    push.saveToken(obj);
    localStorage.setItem('device_token',obj.token);
  });

}

});

})

Above code is working fine. But how do I register the token other controllers? means no within the run() of ionic? In my case I would like not to register the token when the app launch, but when user interact with some part of the app.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>