Cordova plugin issues in ionic serve


#1

Hi!
I have created mobile app using ionic framework, AngularJS, cordova plugins and other stuffs.
When I run ionic serve command, it shows cordova plugin is undefined error.
For example, I have used network plugin of cordova : "https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git"
For this, when I run ionic app on browser, it shows “Cannot read property ‘connection’ of undefined” error when I test these things :

if(navigator.network)
{

var networkState = navigator.network.connection.type;

}
Am I making some mistake or cordova plugins are not supported on desktop browser using ionic serve?
If not, then Is there any way so we can run app with cordova plugin on Desktop browser (using $ionic serve command)?
Because I like the speed of changes made on device browser. It’s just awesomely instant.

For all other commands : $ionic run ios or $ionic emulate ios, we have to wait a lot.
Please help.

Thanks!
Ami


#2

I had a similar problem with the ngCordova Sqlite plugin, ionic serve does not work as you need all the cordova libraries (js and java) as built when you build the android, ios, or other application. try running it in one of your simulators e.g. ionic run android.