Reputation: 14142
Unable to get device info in view -
angular.module('PlatformApp', ['ionic'])
.controller('PlatformCtrl', function($scope) {
ionic.Platform.ready(function(){
// will execute when device is ready, or immediately if the device is already ready.
});
var deviceInformation = ionic.Platform.device();
});
How do I get the device info from the var deviceInformation?
I know deviceInformation.model will retrieve the model name for the device - but the guide on the Ionic site doesn't show how this is done? Everything I seem to try doesn't appear to work getting blank/empty object.
http://ionicframework.com/docs/api/utility/ionic.Platform/
Upvotes: 0
Views: 2526
Reputation: 6063
You need to place your code in platform ready as like follow.
$ionicPlatform.ready(function() {
$scope.deviceInformation = ionic.Platform.device();
});
and you will be available with device information in your controller:
$scope.getDeviceInfo = function() {
alert($scope.deviceInformation.uuid);
}
For more information some how similar question are available on this link .
Hopes this will help you !
Upvotes: 2