Crash in angular-route.min

Hi!

I am having a lot of trouble getting my app to work (again). I’m currently testing a SDK 8 build for android 2.2 on an archos 43 internet tablet. But the program crashes at start. I am getting the error 05-12 14:00:19.329: E/Web Console(1990): Uncaught TypeError: Cannot call method ‘module’ of undefined at file:///android_asset/www/js/lib/angular-route.min.js:7
I can reproduce this error in the emulator.

Building a SDK 10 and installing it on newer devices work. Tested on a samsung galaxy tab 2, Samsung note, HTC one X. Running the app in Chrome browser (windows 8,1)

This problem didn’t occur a few weeks a go, when I was using Ionic 1.0.0 beta 1.

I really hope someone can help, because the Archos is mostly used

Thanks

Nick

If you’re building an Ionic app, you don’t need angular-route at all. So, try removing it to see if that resolves the problem.

In most cases you can just use the ionic-bundle without even needing to manual include ANY Angular libraries like this :

    <link href="/css/ionic.css" rel="stylesheet">
    <script src="js/ionic.bundle.js">

It is not possible to remove angular-route.min.js due an update in angular.

When removing this include I get the following error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module pvbapp due to:
Error: [$injector:modulerr] Failed to instantiate module ngRoute due to:
Error: [$injector:nomod] Module ‘ngRoute’ is not available! You either misspelled the module n……1)

These are my includes:

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>

    <script type="text/javascript" src="js/buildversion.js"></script>

    <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script>

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

    <script type="text/javascript" src="js/lib/angular-route.min.js"></script>

    <script type="text/javascript" src="js/app.js"></script>

buildversion is a generated script file contains nothing than this:
var product_version = ‘’;
var product_version_name = ‘’;
var build_version = ‘’;

Alright. That removed a part of the error. I thought i had an accumulation of problems. But I still have an error. 05-13 13:29:37.689: E/Web Console(2462): Uncaught ReferenceError: angular is not defined at file:///android_asset/www/js/app.js:3 And this is only in the SDK8

The code on line 3:
var app = angular.module(‘appname’, [‘ionic’, ‘appname.services’, ‘appname.controllers’]);

This should probably be different. But what should it be? And how come that this error only occurs on older devices?

It might help if you show your entire <head>. Also, can you post a CodePen sample that does not work on the tablet but does work on CodePen?

Unfortunately, I think Ionic dropped all support for Android 2.2. It is just to hard to create a good experience while supporting such old software and devices.

1 Like

That would be shame. In the previous version of ionic we used for it still worked. But that had a lot of different bugs, so we needed to update.

Here is the main html

My only guess here is that the services and controllers files are getting loaded BEFORE the Ionic bundle. So, in those you probably have something like this :

angular.module('appname.services')

Since angular does not exist yet, you are getting the error. On slower devices, perhaps Ionic is just loading too slowly and the browser is going on to the next files.

I would try to put Ionic higher in the list and the services and controller files at the bottom of the list. I’d also suggest trying the minified version to see if that helps. As it’s smaller it might get loaded before the services and controllers get loaded.