Hi i am developing a hybrid app using the Ionic framework and Cordova. I am looking to use the device uuid as an ID so i have added the cordova device plugin. Additionally i am using the NG-Cordova wrapper for calling my cordova plugins. However whenever i run my app in the xcode Simulator or on an actual Ipad all i get is {{uuid}} .
There does not seem to be any error message i can only assume that the Device Plugin is not working.
i have put my code below however im not sure this is the issue, Has anyone had this issue before and if so how did they work around it?
Controller:
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');
});
the reason behind my issue was due to using a custom build of ngCordova.
if i just the normal or Minified version of ngcordova it works perfectly.
Thanks for all the help.