Mobile Programmer's Mindset

AngularJS + Phonegap Works In Browser Not On Device

I was going crazy for the past 2 days trying to get an Angular app running on my phone.  I had it working in Chrome the way I wanted for testing purposes, and just couldn’t get it onto the device.

Basically I would see the index page, but the app would never bootstrap and get going.  I tried with test apps, and it worked fine.  I tried a very basic app with just 2 way binding and that worked.

Solution ended up being not to use absolute urls.  For example <script src=”/js/index.js”></script> does not work.  You must us <script src=”js/index.js”></script>

The reason is that on the device, everything is accessed as a file, so file:///js/index.js does not exist.

Hope this helps someone not spend so damn long looking for an answer like I did.