Test http://ngcordova.com/docs/#Network in browser

I’m wondering if there is a way to test a mobile app that uses the network information plugin to detect if a device is offline of not. I’d like to test in my browser, but of course when using native plugins the browser can’t be used anymore for development.

I’m only using one plugin in my ionic app to see if there is network connection but since doing that I can’t develop in chrome anymore.

Is there a way to still develop in the browser instead of having to re-install my app with every line of code I change?

Thanks a lot!

ngCordova has ng-cordova-mocks.js file which helps to fake the functionality of plugins on browser. Just include this file instead of ng-cordova.js while working on browser. You can edit default values in this file to test different states of network.

1 Like