TypeError: Cannot read property 'type' of undefined

I have problems in $ cordovaNetwork.
Always appears the error:

TypeError: Cannot read property ‘type’ of undefined

My app.js

angular.module(‘starter’, [‘ionic’,‘ngCordova’])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
if(window.StatusBar) {

.controller(‘MyCtrl’, function($scope, $cordovaNetwork) {
var type = $cordovaNetwork.getNetwork();

var isOnline = $cordovaNetwork.isOnline();

var isOffline = $cordovaNetwork.isOffline();

Could you be more specific to where the line occurs? (file name and line number)

Dude, I had some issues like this, I can suggest you:

  1. Ensure that ngCordova is called BEFORE cordova
  2. Use ngCordova zip from github, the custom generated failed to me
  3. Check if the plugin is properly installed (not ngCordova, but the network plugin

I think those were the steps that saved me.


I tried the steps but the error persists
follows the error.

Console was cleared ripple.js:37
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.) ripple.js:37
GET 404 (Not Found) ripple.js:50
cordova :: Initialization Finished (Make it so.) ripple.js:37
GET 404 (Not Found) (index):22
TypeError: Cannot read property ‘type’ of undefined
at Object.getNetwork (
at new (
at invoke (
at Object.instantiate (
at forEach (
at nodeLinkFn (
at compositeLinkFn (
at compositeLinkFn ( ionic.bundle.js:18930
cordova :: fired deviceready event!

needed to see the source to help out :-/

My project is simple, only started in Ionic !
Sorry my english, i’m brazil.

Project Repository GitHub:

Thanks for help.

As far as I know, Ripple won’t expose a navigator.connect object. You need to either first check if cordova is present, or run it on a device.

if(window.cordova && window.cordova.plugins.Keyboard) {
var type = $cordovaNetwork.getNetwork();

is not possible to test in the browser?
Only in device ?

Thanks !

guys, try everything appears the same undefined error.

I tried now the status bar and appeared StatusBar is not defined!

What’s wrong?

I’m testing using the chrome ripple can this be?


I think so… try to use “ionic serve”

Have same trouble…, work fine with ionic serve on browser on device (android 5.0.1) throw this.
$cordovaNetwork used like:
$scope.isOnline = $cordovaNetwork.isOnline();

ngCodrova included in index.html before cordova.js etc.
ngCordova v0.1.12-alpha
ionicframework v1.0.0-beta.14

SOLVED :smiley:

As suggested here on stackoverflow, ripple does not have an in-browser keyboard simulator, so once you upload your app to the device, error will be gone.

For “in-browser testing”, just comment out the section which checks if keyboard is shown