Need help with $rootscope and $cordovaNetwork

Hello, ive been working on an app for a while now with a few plugins added.
But the app cant function properly without connection, so i wanted to add the $cordovaNetwork

But here comes my problem all the sudden.
when i add the $cordovaNetwork or $rootscope to my controller i keep getting an Unknown provider
.controller('loginCtrl', ['$scope', '$state', '$ionicHistory', '$localstorage', '$http', 'Auth', 'Login', '$cordovaNetwork', function ($scope, $state, $ionicHistory, $localstorage, $http, Auth, Login, $cordovaNetwork) { .... }

Error: [$injector:unpr] Unknown provider: $cordovaNetworkProvider <- $cordovaNetwork <- loginCtrl

// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers', ''])

.factory('$localstorage', ['$window', function ($window) {
    return {
        set: function (key, value) {
            $window.localStorage[key] = value;
        get: function (key, defaultValue) {
            return $window.localStorage[key] || defaultValue;
        setObject: function (key, value) {
            $window.localStorage[key] = JSON.stringify(value);
        getObject: function (key) {
            return JSON.parse($window.localStorage[key] || '{}');
        removeObject: function (key) {

.run(function ($ionicPlatform) {
    if (window.StatusBar) {
    $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) {


.config(function ($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
      .state('app', {
          url: '/app',
          abstract: true,
          templateUrl: 'templates/menu.html',
          controller: 'AppCtrl',
          onEnter: function ($state, Auth, Contacts) {
              if (!Auth.isLoggedIn()) {
    .state('app.main', {
        url: '/main',
        views: {
            'menuContent': {
                templateUrl: 'templates/main.html',
                controller: 'mainCtrl'
    .state('login', {
        url: '/login',
        templateUrl: "templates/login.html",
        controller: 'loginCtrl',
        onEnter: function ($state, Auth) {
            if (Auth.isLoggedIn()) {
    // if none of the above states are matched, use this as the fallback


so please what am i doing wrong?


look at this solution

Ive already seen that one, and I cant seem to figur out how i do this, ive just updated the question with my app.config and, so please if you could show how it is supposed to be


did you injected ‘ngCordova’ in your module . Use Cordova Network Information plugin

and add below code before . see if you are getting network information on console ?

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {



Ive just added the code, the console output is wifi.

about the ngCordova I’m not sure what is ment with this sorry. im still new with ionic app development
the first thread got my entire app.js
and ive used the cordova plugin add cordova-plugin-network-information

check for internet connection if it’s working or not

 if ( == Connection.NONE) {
                        title: '<h1 class="delete_popup">No Internet Connection !<br>',
                        template: '<h2 class="ceter_popup_text">You have no Internet Connection</h2>',
                        cssClass: 'custom-popup',
                        buttons: [{
                            text: 'Try Again',
                            onTap: function (e) {


        }, {
                            text: 'Cancel',
                            onTap: function (e) {




thank you works great. Do this use the plugin or can i remove it again?


No don’t remove this plugin .whole working is depend on this plugin

okay, thank you very much.