javascript - Windows Phone 7 and 8 with PhoneGap + Angular dies during bootstrapping - Stack Overflow

Windows Phone 7 or 8PhoneGap 3AngularJS 1.2I have a PhoneGap app using AngularJS that works great on i

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

I have a PhoneGap app using AngularJS that works great on iOS and Android, but I'm having a problem getting it to work on Windows Phone 7 and 8.

The app starts fine and I see my index.html page (which in my case is just a loading screen). Source files are loaded and my pre-boot code is running fine.

Then it stops and nothing happens.

I've littered "console.log" messages throughout the code and I see it gets to the point of angular.bootstrap() and then dies. I'm not familiar enough with angular to know what to do next or how to debug this further to track down what the absolute problem code might be. Inside of bootstrap() begins the maze of DI calls so the code bees much less linear.

I do see this error in the console but 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 is logged to the console. I tried delaying all of my bootstrap code by 10 seconds with a setTimeout and that error is always reported before angular.bootstrap() is called, so I don't know if it is even related.

Also worth noting that I've tried the app in IE on the desktop and it works fine there.

So my question is: How do I go about debugging this?

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

I have a PhoneGap app using AngularJS that works great on iOS and Android, but I'm having a problem getting it to work on Windows Phone 7 and 8.

The app starts fine and I see my index.html page (which in my case is just a loading screen). Source files are loaded and my pre-boot code is running fine.

Then it stops and nothing happens.

I've littered "console.log" messages throughout the code and I see it gets to the point of angular.bootstrap() and then dies. I'm not familiar enough with angular to know what to do next or how to debug this further to track down what the absolute problem code might be. Inside of bootstrap() begins the maze of DI calls so the code bees much less linear.

I do see this error in the console but 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 is logged to the console. I tried delaying all of my bootstrap code by 10 seconds with a setTimeout and that error is always reported before angular.bootstrap() is called, so I don't know if it is even related.

Also worth noting that I've tried the app in IE on the desktop and it works fine there.

So my question is: How do I go about debugging this?

Share Improve this question asked Aug 29, 2013 at 17:21 chroderchroder 4,4733 gold badges29 silver badges43 bronze badges 3
  • Do you have a stack trace when you try to run it? – 123 456 789 0 Commented Sep 4, 2013 at 19:30
  • Did you ever find a solution to your problem? I have a very similar problem, although I never see any errors in the console. I did locate an issue with this line in Angular: var injector = createInjector(modules); which appears to fail if I have dependencies in my app module, but seems to run without them. I still get a blank screen either way. – Gregir Commented Nov 8, 2013 at 22:43
  • I think I may have a found a solution to this problem. I was able to get a simple example up and running, I posted some code snippets on this github thread here: github./angular/angular.js/issues/4288 , if people are interested I can put a sample app on my github so everyone can see the source code but you should be able to get it working with the snippets I posted, it worked for me with angular 1.2, windows phone 8, and phonegap 3.2 RC1 – Robert-W Commented Nov 18, 2013 at 0:53
Add a ment  | 

3 Answers 3

Reset to default 2

I am unsure of WP7/8 but if it follows Windows 8 pattern try adding JQuery 2.0 before angular.js

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

I agree with Jason, use Windows special/custom jQuery. 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>

The functionality of the Windows 8-patch had been included in jQuery 2.0. So 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>

I don't think this error is relevant because it is present even if you start Cordova/Phongap template app (I tried with Cordova 2.9.0). Visual Studio dosen't give any good explanation why app is not running, that's why I tried weinre and got the following massage on app reloade with 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/ponents/angular/angular.js:9457:7)
at sendReq (x-wmapp0://www/ponents/angular/angular.js:9334:9)
at $http (x-wmapp0://www/ponents/angular/angular.js:9125:7)
at Anonymous function (x-wmapp0://www/ponents/angular/angular.js:9268:11)
at Anonymous function (x-wmapp0://www/ponents/angular/angular.js:7592:17)
at wrappedCallback (x-wmapp0://www/ponents/angular/angular.js:6996:15)
at wrappedCallback (x-wmapp0://www/ponents/angular/angular.js:6996:15)
at Anonymous function (x-wmapp0://www/ponents/angular/angular.js:7033:11)
at $eval (x-wmapp0://www/ponents/angular/angular.js:8219:9)

I reported it to angular here

EDIT

I managed to get a basic angular app running in phonegap WP7 (haven't tested it yet on WP8) by

  1. applying fix from github ( I can't post second link not enough reputation)

    @github/RobbinHabermehl/angular.js/mit/2645faad908529b5d33af960270755dd65a9aa78

  2. including jquery (2.0.3) above angular.js

  3. changing line of code in angular from

    var xhr = new XHR();

to

var xhr = new XMLHttpRequest(); 
  1. manually bootstrapping angular app after cordova deviceready event fired

I reported it in my original thread here

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745117784a4612232.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信