Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70909

How to import ionic-native into an Ionic1/AngularJS project?

$
0
0

@aubreyq wrote:

I’m writing an app with Cordova, Ionic v1 and AngularJS.

I want to implement push notifications in my app and I have considered using this plugin. I see the documentation for Ionic 3 & 4.

I was able to get this working on a plain JS project with cordova but not yet with the Ionic 1 & AngularJS integration.

I get undefined from the window object.

How can I access this plugin from within the AngularJS context?

  console.log(window);

  //do the push notifications here
  console.log(window.FirebasePlugin); //undefined

  console.log($window.FirebasePlugin); //undefined

  // window.FirebasePlugin.getToken(function(fcmToken) { //undefined
  //     console.log(fcmToken);
  // }, function(error) {
  //     console.error(error);
  // });

  // $window.FirebasePlugin.getToken(function(fcmToken) { //undefined
  //     console.log(fcmToken);
  // }, function(error) {
  //     console.error(error);
  // });

Here is my code: https://github.com/aquinn637/IonicPushTest

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70909

Trending Articles



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