Uncaught ReferenceError: Ionic is not defined for Ionic Push

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

I'm trying to add Ionic.io Push to my application but its throwing Ionic is not defined

ReferenceError: Ionic is not defined
var push = new Ionic.Push({

Everything is working fine except this undefined error, I've run this command to update lib but nothing happen, bundle version is * Ionic, v1.1.0

ionic lib update

My app.js

angular.module('TestApp', ['ionic','ionic.service.core',
                            'ionic.service.push',
                            'lavoApp.controllers',
                            'lavoApp.services','ngCordova'])
.run(function($ionicPlatform,$rootScope,$location,$timeout,$anchorScroll,$state,$ionicHistory,$cordovaPush) {

    $ionicPlatform.ready(function() {

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

        push.register(function(token) {
          console.log("Device token:",token.token);
        });
profilepic.png
manpreet 2 years ago

Just add below line after

<script src="lib/ionic/ionic.bundle.js">script>

in your index.html file.

<script src="lib/ionic-platform-web-client/dist/ionic.io.bundle.js">script>

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community