Windows Phone 7 and 8 with PhoneGap + Angular dies at boot time

  • Windows Phone 7 or 8
  • Phonegap 3
  • AngularJS 1.2

I have a PhoneGap application using AngularJS that works fine on iOS and Android, but I had a problem with it working on Windows Phone 7 and 8.

The application starts up normally, and I see my index.html page (which in my case is just a loading screen). The source files load and my pre-boot code works fine.

Then he stops and nothing happens.

I damaged console.log messages throughout the code, and I see that it reaches the point of angular.bootstrap() and then dies. I am not familiar with angular enough to know what to do next, or how to debug it further to determine what could be the absolute code of the problem. Inside the bootstrap (), the maze of DI calls begins, so the code becomes much less linear.

I see this error in the console, but I have no idea what it means or how to fix it:

 An exception of type 'System.NotSupportedException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary 

No other errors or any output are written to the console. I tried to delay all of my boot code for 10 seconds using setTimeout, and this error is always reported before angular.bootstrap() is angular.bootstrap() , so I don't know if this is even related.

It's also worth noting that I tried the app in IE on the desktop, and it works great there.

So my question is: how do I debug this?

+8
javascript angularjs cordova windows-phone-8
source share
3 answers

I'm not sure about WP7 / 8, but if it follows the Windows 8 pattern, try adding jQuery 2.0 to angular.js

http://net.tutsplus.com/tutorials/javascript-ajax/building-windows-store-applications-with-jquery-2-0/

+2
source share

I agree with Jason, using special / custom jQuery for Windows. And add unsafe=true

 <script src="js/jquery-1.8.2-win8-1.0.min.js"></script> <script type="text/javascript"> jQuery.isUnsafe = true; </script> 

Windows 8-patch functionality was included in jQuery 2.0. That way you can just use jQuery 2.0 in the same way and it will work.

So you can also use:

 <script src="/lib/jquery-2.0.0.min.js"></script> <script> jQuery.isUnsafe = true; </script> 
+1
source share

I do not think this error is relevant because it is present even if you run the application for the Cordoba / Phongap template (I tried with Cordova 2.9.0). Visual Studio does not give any good explanation why the application is not working, so I tried and got the following massage on the reloade of the application using angular -1.0.8

 Error: Access is denied. at hookedFunction (http://"my-weinre-ip":8080/target/target-script-min.js#ddtest:551:1) at Anonymous function (x-wmapp0://www/components/angular/angular.js:9457:7) at sendReq (x-wmapp0://www/components/angular/angular.js:9334:9) at $http (x-wmapp0://www/components/angular/angular.js:9125:7) at Anonymous function (x-wmapp0://www/components/angular/angular.js:9268:11) at Anonymous function (x-wmapp0://www/components/angular/angular.js:7592:17) at wrappedCallback (x-wmapp0://www/components/angular/angular.js:6996:15) at wrappedCallback (x-wmapp0://www/components/angular/angular.js:6996:15) at Anonymous function (x-wmapp0://www/components/angular/angular.js:7033:11) at $eval (x-wmapp0://www/components/angular/angular.js:8219:9) 

I reported this angular here

EDIT

I managed to get the basic angular application running on the WP7 phone bundle (I haven't tested it on WP8 yet) on

  • Applying a fix from github (I can't post the second link not enough reputation)

    @ GitHub / RobbinHabermehl / angular.js / commit / 2645faad908529b5d33af960270755dd65a9aa78

  • including jquery (2.0.3) above angular.js

  • changing a line of code in angular from

    var xhr = new XHR ();

to

 var xhr = new XMLHttpRequest(); 
  • manually angular boot application after ending cordova deviceready event

I reported this in my source thread here

+1
source share

All Articles