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

Inject Ionic push in other controllers

$
0
0

@eldy wrote:

According to the doc http://docs.ionic.io/v2.0.0-beta/docs/push-full-setup#section-3-5-add-some-push-code

I have to register my device token in run()

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
var push = new Ionic.Push({
"debug": true
});

push.register(function(token) {
  console.log("Device token:",token.token);
  push.saveToken(token);  // persist the token in the Ionic Platform
});

});
})

But can use new Ionic somewhere else? means in my other controller? I tried to inject but failed. Why the official doc is poorly written. :frowning:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49084

Trending Articles



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