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

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

我正在使用 cordova 和 ionic 开发 windows phone 应用程序。我正在使用网络上下文。

当我 运行 应用程序时,它会在我的 controllers.js 文件中抛出上述错误。

我已经在cordova中添加了网络插件。我不知道为什么会这样。

我在为 isOnline 变量分配以下值时在以下行收到错误:

navigator.connection.type

问题很可能出在 ng-cordova js 和 cordova.js 文件的位置上。我通过将 ng-cordova 文件放在 cordova.js 文件之前来解决它。并且这两个文件都需要在启动 html 页面中。

如果一个或两个 javascript 文件版本与安装的网络信息插件无关,也可能会出现此问题。