Ionic Cordova Device UUID
Hallo, ich bin die Entwicklung einer hybrid-app mit dem Ionic framework und Cordova. Ich bin auf der Suche für die Verwendung des Geräts die uuid als eine ID-so habe ich die cordova device plugin. Zusätzlich werde ich mit Hilfe der NG-Cordova-wrapper für den Aufruf meiner cordova-plugins. Aber wenn ich meine app im xcode-Simulator oder auf einem tatsächlichen Ipad alles, was ich bekommen ist {{uuid}} .
Scheint es nicht zu sein, keine Fehlermeldung ich kann nur davon ausgehen, dass das Gerät Plugin nicht funktioniert.
ich habe meinen code unten, jedoch im nicht sicher, das ist die Frage, Hat jemand hatte dieses Problem vor, und wenn ja, wie haben Sie es umgehen?
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');
});
Ich brauche ng-controller aufgrund seines namens in der route... sorry sollte deutlich gemacht
aktualisiert die Frage auf meine app.js Datei
Ich sehe nicht, dass Sie aufgenommen haben ngCordova in Ihre Winkel.Modul-Richtlinie. Ist es mehr code wir vermissen?
Wenn ich ngCordova in der app-es gibt nur einen leeren Bildschirm und nicht arbeiten... ich denke, dass dies möglicherweise die Ursache meiner Probleme, wenn ich ein ganz neues Projekt und schließen die ngCordova in meinem Modul funktioniert alles einwandfrei.
InformationsquelleAutor Adam | 2014-12-05
Du musst angemeldet sein, um einen Kommentar abzugeben.
den Grund für mein Problem wurde durch die Verwendung einer benutzerdefinierten build von ngCordova.
wenn ich nur die normale oder die Minified-version von ngcordova es funktioniert perfekt.
Dank für all die Hilfe.
InformationsquelleAutor Adam