离子科尔多瓦设备UUID
问题描述:
嗨,我正在开发一个混合应用程序使用离子框架和科尔多瓦。我正在使用设备uuid作为ID,所以我添加了cordova设备插件。此外,我使用NG-Cordova包装来呼叫我的科尔多瓦插件。但是,无论何时我在xcode模拟器或实际的Ipad上运行我的应用程序,我都会获得{{uuid}}。离子科尔多瓦设备UUID
似乎有不被任何错误消息我只能假设该设备插件不工作。
我已经把我的代码如下但是林不知道这是问题,有没有人有这个问题,他们是怎么解决它之前,如果是这样?
控制器:
angular.module('starter.controllers', []).controller('DashCtrl', function(
$scope, $state, $cordovaDevice) {
var init = function() {
console.log("initializing device");
try {
$scope.uuid = $cordovaDevice.getUUID();
} catch (err) {
console.log("Error " + err.message);
alert("error " + err.$$failure.message);
}
};
init();
})
的Html
<ion-view title="Dashboard">
<ion-content class="padding">
<h1>Dash</h1>
{{uuid}}
</ion-content>
</ion-view>
app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(
true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
}).config(function($stateProvider, $urlRouterProvider) {
$stateProvider
// setup an abstract state for the tabs directive
.state('tab', {
url: "/tab",
abstract: true,
templateUrl: "templates/tabs.html"
})
// Each tab has its own nav history stack:
.state('tab.dash', {
url: '/dash',
views: {
'tab-dash': {
templateUrl: 'templates/tab-dash.html',
controller: 'DashCtrl'
}
}
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/dash');
});
答
背后我的问题的原因是由于使用的自定义生成ngCordova。
,如果我只是ngcordova的正常或缩小的版本,它完美的作品。
感谢您的帮助。
是一个错字或是你真的错过ng控制器? – 2014-12-05 10:41:42
我不需要NG-控制器,因为其所谓的路线...对不起应该说的很清楚 – Adam 2014-12-05 10:46:59
更新的问题,包括我的app.js文件 – Adam 2014-12-05 10:49:34