在设备上运行离子项目时出错

时间:2015-08-19 06:51:01

标签: android ionic

我在运行它时在设备上收到以下错误,因为它在浏览器上只运行了erron并且只运行了我的设备并检查了所有设备但是同样的问题

任何人都可以帮助我

Uncaught TypeError:在非对象ionic.bundle.js:9110上调用Object.keys 无法加载资源:net :: ERR_CACHE_MISS https://cdn.auth0.com/client/cWQeRf3L4Ength5tIFSrPhrNPUHgO6yQ.js?t1439965186084 未捕获的错误:[$ rootScope:infdig] 10 $ digest()迭代达成。中止! 观察者在最近5次迭代中被解雇:[] http://errors.angularjs.org/1.3.13/ $ rootScope / infdig?p0 = 10& p1 =%5B%5D ionic.bundle.js:22980



// 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', 'ngCordova', 'starter.controllers','starter.directives',  'auth0',
  'angular-storage',
  'angular-jwt', 'ngFileUpload','ngResource','ngRoute'])


.config(['$httpProvider', function($httpProvider) {
        $httpProvider.defaults.useXDomain = true;
        $httpProvider.defaults.headers.common = 'Content-Type: application/json';
        delete $httpProvider.defaults.headers.common['X-Requested-With'];
    }
])

.config(function($compileProvider){
  $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|file|blob|cdvfile|content):|data:image\//);
})




.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) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})
 

 
/*File factory for browse*/
.factory("$fileFactory", function($q) {



    var File = function() { };
console.log("This is in file factory");
    File.prototype = {

        getParentDirectory: function(path) {
            var deferred = $q.defer();
            window.resolveLocalFileSystemURI(path, function(fileSystem) {
                fileSystem.getParent(function(result) {
                    deferred.resolve(result);
                }, function(error) {
                    deferred.reject(error);
                });
            }, function(error) {
                deferred.reject(error);
            });
            return deferred.promise;
        },

        getEntriesAtRoot: function() {
            var deferred = $q.defer();
			console.log("This is in get Entries in root");
            window.webkitrequestFileSystem(1, 0, function(fileSystem) {
                var directoryReader = fileSystem.root.createReader();
                directoryReader.readEntries(function(entries) {
                    deferred.resolve(entries);
                }, function(error) {
                    deferred.reject(error);
                });
            }, function(error) {
                deferred.reject(error);
            });
            return deferred.promise;
        },

        getEntries: function(path) {
            var deferred = $q.defer();
            window.resolveLocalFileSystemURI(path, function(fileSystem) {
                var directoryReader = fileSystem.createReader();
                directoryReader.readEntries(function(entries) {
                    deferred.resolve(entries);
                }, function(error) {
                    deferred.reject(error);
                });
            }, function(error) {
                deferred.reject(error);
            });
            return deferred.promise;
        }

    };

    return File;

})


.factory('Post', function($resource) {
  return $resource('http://104.155.192.54:8080/api/logins');
})

.config(function($compileProvider){
  $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/);
})
/*This is file browser in ionic */




.factory('Camera', ['$q', function($q) {

  return {
    getPicture: function(options) {
      var q = $q.defer();

      navigator.camera.getPicture(function(result) {
        // Do any magic you need
        q.resolve(result);
      }, function(err) {
        q.reject(err);
      }, options);

      return q.promise;
    }
  }
}])


.config(['$httpProvider', function($httpProvider) {
        $httpProvider.defaults.useXDomain = true;
        $httpProvider.defaults.headers.common = 'Content-Type: application/json';
        delete $httpProvider.defaults.headers.common['*'];
    }
	])
.factory('merchantRegisterFactory', function($http) {
  var urlBase = 'http://104.155.192.54:8080/api/merchantlogins';
  var _loginService = {};
 
  _loginService.getLogins = function() {
    return $http.get(urlBase);
  };
 
  _loginService.saveLogin = function(login) {
	  console.log("This is factory is merchantlogins app.js save");
    return $http.post(urlBase,login);
  };
 
  _loginService.updateLogin = function(login) {
    return $http.put(urlBase, login);
  };
 
  _loginService.deleteLogin = function(id) {
    return $http.delete(urlBase + '/' + id);
  };
 
  return _loginService;
})

.factory('addOffer', function($http) {
  var urlBase = 'http://104.155.192.54:8080/api/addoffers';
  var _addofferService = {};
 
  _addofferService.getOffers = function() {
    return $http.get(urlBase);
  };
 
  _addofferService.saveOffer = function(login) {
	  console.log("This is factory is addoffers app.js save");
    return $http.post(urlBase,login);
  };
 
  _addofferService.updateoffer = function(login) {
    return $http.put(urlBase, login);
  };
 
  _addofferService.deleteOffer = function(id) {
    return $http.delete(urlBase + '/' + id);
  };
 
  return _addofferService;
})




.factory('loginsFactory', function($http) {
  var urlBase = 'http://104.155.192.54:8080/api/logins';
  var _loginService = {};
 
  _loginService.getLogins = function() {
    return $http.get(urlBase);
  };
 
  _loginService.saveLogin = function(login) {
	  
	  
	  
	  console.log("This is factory Login is app.js save");
    return $http.post(urlBase,login);
  };
 
  _loginService.updateLogin = function(login) {
    return $http.put(urlBase, login);
  };
 
  _loginService.deleteLogin = function(id) {
    return $http.delete(urlBase + '/' + id);
  };
 
  return _loginService;
})




.run(function($rootScope, auth, store, jwtHelper, $location) {
  // This events gets triggered on refresh or URL change
  var refreshingToken = null;
  $rootScope.$on('$locationChangeStart', function() {
    var token = store.get('token');
    var refreshToken = store.get('refreshToken');
    if (token) {
      if (!jwtHelper.isTokenExpired(token)) {
        if (!auth.isAuthenticated) {
          auth.authenticate(store.get('profile'), token);
        }
      } else {
        if (refreshToken) {
          if (refreshingToken === null) {
              refreshingToken =  auth.refreshIdToken(refreshToken).then(function(idToken) {
                store.set('token', idToken);
                auth.authenticate(store.get('profile'), idToken);
              }).finally(function() {
                  refreshingToken = null;
              });
          }
          return refreshingToken;
        } else {
          $location.path('/login');
        }
      }
    }

  });
})

.config(function($stateProvider, $urlRouterProvider, authProvider, $httpProvider,
  jwtInterceptorProvider) {
  
  
   jwtInterceptorProvider.tokenGetter = function(store, jwtHelper, auth) {
    var idToken = store.get('token');
    var refreshToken = store.get('refreshToken');
    // If no token return null
    if (!idToken || !refreshToken) {
      return null;
    }
    // If token is expired, get a new one
    if (jwtHelper.isTokenExpired(idToken)) {
      return auth.refreshIdToken(refreshToken).then(function(idToken) {
        store.set('token', idToken);
        return idToken;
      });
    } else {
      return idToken;
    }
  }

  $httpProvider.interceptors.push('jwtInterceptor');
  
  
  
  $stateProvider

  
  
  

  .state('app', {
    url: "/app",
    abstract: true,
    templateUrl: "templates/menu.html",
    controller: 'AppCtrl'
  })

  .state('app.addoffer', {
    url: "/addoffer",
    views: {
      'menuContent': {
	        templateUrl: "templates/addoffer.html",
			 controller: 'MapCtrl'
      }
    }
  })

  .state('app.browse', {
    url: "/browse",
    views: {
      'menuContent': {
        templateUrl: "templates/browse.html"
      }
    }
  })
    .state('app.playlists', {
		 cache: false,
      url: "/playlists",
      views: {
        'menuContent': {
          templateUrl: "templates/playlists.html",
          controller: 'ExampleController'
        }
      }
    })

  .state('app.single', {
	  cache: false,
    url: "/playlists/:playlistId",
    views: {
      'menuContent': {
        templateUrl: "templates/playlist.html",
        controller: 'ExampleController'
      }
    } 
  });
  
   authProvider.init({
    domain: 'lokaloffers.auth0.com',
    clientID: 'cWQeRf3L4Ength5tIFSrPhrNPUHgO6yQ',
    loginState: 'login'
  });

  
  
  
  
  
  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/app/playlists');
})
.run(function(auth) {
  // This hooks all auth events to check everything as soon as the app starts
  auth.hookEvents();
});
&#13;
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
	<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * &apos;unsafe-inline&apos;; script-src * &apos;unsafe-inline&apos; &apos;unsafe-eval&apos;">
    <title></title>
    <!-- compiled css output -->
    <link href="css/ionic.app.css" rel="stylesheet">
	<link href="css/animate.css" rel="stylesheet">
	<link href="lib/ionic/css/ionic.css" rel="stylesheet">
	<link href="css/style.css" rel="stylesheet">
    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above    -->
    <!-- <link href="css/ionic.app.css" rel="stylesheet">-->
	<!-- ionic/angularjs js -->
    <script type="text/javascript" src="lib/ionic/js/ionic.bundle.js"></script>
	
	<!-- ngCordova script -->
	<script  type="text/javascript" src="lib/ngCordova/dist/ng-cordova.js"></script>
	<script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript"  src="lib/angular-resource/angular-resource.js"></script>
	<script type="text/javascript" src="lib/ng-file-upload/ng-file-upload-shim.min.js"></script> 
	<script type="text/javascript" src="lib/ng-file-upload/ng-file-upload.min.js"></script> 
	<!-- Auth0 Lock -->
	<script type="text/javascript" src="lib/auth0-lock/build/auth0-lock.js"></script>
	<!-- auth0-angular -->
	<script type="text/javascript" src="lib/auth0-angular/build/auth0-angular.js"></script>
	<!-- angular storage -->
	<script type="text/javascript" src="lib/a0-angular-storage/dist/angular-storage.js"></script>
	<!-- angular-jwt -->
	<script type="text/javascript" src="lib/angular-jwt/dist/angular-jwt.js"></script>
	<!--
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCqGXcExPSUxrVMpnfBciUejJRU06ZYelE&amp;sensor=true"></script>
	<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;libraries=places&amp;signed_in=true"></script>
	<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC_cy8C8pj5urqUSWERE-qU8NmkoNg6jpk&amp;sensor=true"></script>
	-->
    <!-- your app's js -->
    <script type="text/javascript" src="js/app.js"></script>
    <script type="text/javascript" src="js/app1.js"></script>
	<script type="text/javascript" src="js/directives.js"></script>
	<script type="text/javascript" src="lib/angular-route/angular-route.min.js"></script>
	<script type="text/javascript" src="lib/angular-route/angular-route.js"></script>
	<script type="text/javascript" src="js/app.js"></script>
	<script type="text/javascript" src="js/factory.js"></script>
	<script type="text/javascript" src="js/controllers.js"></script>
	<script type="text/javascript" src="js/countries.js"></script>
	<script type="text/javascript" charset="utf-8">
    // Wait for Cordova to load
    // 
    document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        checkConnection();
    }

    function checkConnection() {
        var networkState = navigator.connection.type;

        var states = {};
        states[Connection.UNKNOWN]    = 'Unknown connection';
        states[Connection.ETHERNET]    = 'Ethernet connection';
        states[Connection.WIFI]       = 'WiFi connection';
        states[Connection.CELL_2G]    = 'Cell 2G connection';
        states[Connection.CELL_3G]    = 'Cell 3G connection';
        states[Connection.CELL_4G]    = 'Cell 4G connection';
        states[Connection.NONE]       = 'No network connection';

        alert('Connection type: ' + states[networkState]);
    }

    </script>
	</head>
	<body ng-app="starter">
    <ion-nav-view></ion-nav-view>
	</body>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

HI感谢您的建议但是我用离子CLI解决了我的问题它的错误,将其更新到最新版本并且工作正常