通过以下方式安装了cordova设备插件:
sudo cordova plugin add org.apache.cordova.device
然后下载ngCordova,并将ng-cordova.min.js包含在js文件夹中,并且也包含在index.html中
接下来我所做的是注射ngCordova如下
angular.module('starter', ['ionic', 'starter.controllers','ngCordova'])
然后包含在控制器中,如下所示
angular.module('starter.controllers', []) .controller('AppCtrl', function($scope, $ionicModal, $timeout, $ionicPlatform,$cordovaDevice) but still getting the following errors ReferenceError: device is not defined at Object.getUUID (http://localhost:8100/js/ng-cordova.min.js:1:14929) at new <anonymous> (http://localhost:8100/js/controllers.js:27:26) at invoke (http://localhost:8100/lib/ionic/js/ionic.bundle.js:11591:17) at Object.instantiate (http://localhost:8100/lib/ionic/js/ionic.bundle.js:11602:23) at http://localhost:8100/lib/ionic/js/ionic.bundle.js:14906:28 at updateView (http://localhost:8100/lib/ionic/js/ionic.bundle.js:42986:30) at eventHook (http://localhost:8100/lib/ionic/js/ionic.bundle.js:42933:17) at Scope.$broadcast (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20605:28) at $state.transition.resolved.then.$state.transition (http://localhost:8100/lib/ionic/js/ionic.bundle.js:34122:22) at wrappedCallback (http://localhost:8100/lib/ionic/js/ionic.bundle.js:19197:81)
您现在可以告诉我出了什么问题吗?
如果还有另一种读取设备UUID的方法,请向我说明。
哇,通过这个问题,我发现自己在做什么错。http://forum.ionicframework.com/t/problem-to-use- ngcordova-device-is-not- defined/11979
当我们在具有Cordova支持的平台以外的其他设备上进行测试时,会发生这种情况。这对我来说是一个有用的发现。