l7ovqa
Last Updated: February 25, 2016
·
1.985K
· Traxmaxx

Using Batarang with AngularJS and PhoneGap/Cordova

When manually starting AngularJS instead of using ng-app, wrap the boostrap inside of angular.element(document).ready

angular.element(document).ready(function() {
  angular.bootstrap(document, ['myApp']);
});

This will allow Batarang to detect your AngularJS app again.

When previewing PhoneGap/Cordova apps on Desktop, you could just open www/index.html in your Browser. In case you're doing this, Chrome needs to be started with --enable-file-cookies which will make Batarang work on pages loaded through file:// instead of http://.

In OSX run this in the Terminal:

open /Applications/Google\ Chrome.app -n --args --enable-file-cookies

2 Responses
Add your response

15835

Are you testing the code in a Chrome Desktop or Chrome in Android? Most Cordova calls will fail in Desktop, no? I'd like to know how to profile performance with BATARANG directly on the ChromeWebClient JS interpreter. Any clues?

over 1 year ago ·
15857

I'm testing it in Chrome Desktop. Unfortunately Batarang does not work when inspecting a Cordova/PhoneGap application through chrome://inspect/#devices

What do you mean with Cordova calls? Our API calls are working both on Chrome Desktop and Android. For data persistence we use the Cordova-SQLitePlugin on Android and WebSQL when debugging on Chrome Desktop.

In case you want to profile certain function calls on Android you could use
javascript console.time('FunctionName'); myFunctionCall(); console.timeEnd('FunctionName');
and check the console output in developer tools.

over 1 year ago ·