White Screen with Angular Moments

Hi,

My apologies if this is not the right place to post this.

I created a starter app and compiled it and it ran on my Samsung S4. Great :smile:

I modified the app and it works perfectly in the chrome browser. After installing the modified onto my phone I got the White Screen of Death. After many hours of searching and trying everything I could find, still no joy.

I decided to start removing code until it worked again. Finally it started working again after removing the Angular Moments.

In the index.html

<!-- moment -->
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>

<!-- angular moment -->
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-moment/0.8.2/angular-moment.min.js"></script>

The app still works with these lines in the index.html. It only stops working when I include it in the app.js.

var app = angular.module(‘MyApp’, [‘ionic’, ‘MyApp.controllers’, ‘firebase’, ‘angularMoment’])

If i remove the angularMoment the app works on the phone.

var app = angular.module(‘MyApp’, [‘ionic’, ‘MyApp.controllers’, ‘firebase’])

I am very new to Angular, Ionic and app development in general so I am unable to figure out why it does not work so for now I will do without it.

I hope this helps somebody and that someone can figure it out. :smile:

Any messages in the console logs? Have you tried Chrome Remote Debugging?

Removing code bit by bit until it works again doesn’t sound like the best way to debug issues. :wink:

Hi encodedmirko,

Sorry about my delayed response. I didn’t think anyone would respond to this post.

Unfortunately I can’t get the Chrome remote debugging to work. Chrome just will not see the device. (Galaxy S4, Model Number GT-I9507 Android Version 4.4.2). When I followed the documentation their was a part where you selected the device model number. GT-I9507 was not there. It would be really useful to remote debug.

I agree that removing code bit by bit is not the best. It’s a real pain actually. Without the being able to debug on the device I am flying blind. Plus I am still very new to Ionic and mobile development so half the time I don’t know what I am doing. Not a good recipe :wink:

Hey, I got the remote debug working :smile:

Thought I would give it another go after reading your post. I just needed to restart the adb server as shown in http://stackoverflow.com/questions/21546468/chrome-remote-debug-samsung-galaxy-s4

I also had to untick the USB debugging and tick it again and go through the authentication process on the phone.

It doesn’t work because you try to load ‘moment.js’ and ‘angular-moment’ from a protocol relative url, //cdnjs.cloudflare.com. In a cordova/ionic app on a device you cannot use this. Replace with http:// (or https://) . Because these libraries cannot be loaded ‘angularMoment’ is not available in your app.js.
It is better to include these libraries in your project locally and not to load them from a remote url. Your app can work in offline mode that way, and it prevents downloads for your app users.