Search code examples
angularjscordovaionic-frameworkwindows-phone-8.1apache-cordova

TypeError: Unable to get property 'isOnline' of undefined or null reference - Cordova Windows Phone - navigator.connection.type is null


I am developing windows phone app using cordova and ionic. I am using web context.

When I run the app, it throws me above error in my controllers.js file.

I have already added network plugin in cordova. I am unable to know why this happens.

I get the error at below line while assigning below value to isOnline variable :

navigator.connection.type


Solution

  • The problem is most probably in placement of ng-cordova js and cordova.js file. I solved it by putting ng-cordova file before cordova.js file. And both file needs to be in startup html page only.

    The problem may also arise if one or both javascript file version is not relevant to the installed network-information plugin.