Cannot get device info using Ionic/Cordova


#1

I have installed the latest versions of Ionic & Cordova, I am simply trying to collect the device name (e.g Nexus 5) to my application views.

I tried using the ionic.Platform helper but this gave me an empty device() - can anyone explain what is wrong?

P.S This is the coffee script

`angular.module('hgApp', [
'ionic',
'services'
]).run(($ionicPlatform, $rootScope) ->
  aboutPageFunction($rootScope)
  $ionicPlatform.ready ->
  if window.cordova and window.cordova.plugins.Keyboard
  cordova.plugins.Keyboard.hideKeyboardAccessoryBar true
  cordova.plugins.Keyboard.disableScroll true
if window.StatusBar
  StatusBar.styleDefault()
 return
return
).config [
 '$stateProvider'
 '$urlRouterProvider'
 ($stateProvider, $urlRouterProvider) ->
  $stateProvider.state('app',
  url: '/app'
  abstract: true
  templateUrl: './sections/menu/menu.tpl.html'
  controller: 'roomList'
).state('app.myHouse',
  url: '/myHouse'
  views:
    'menuContent':
    templateUrl: './sections/myHouse/myHouse.tpl.html'
$urlRouterProvider.otherwise 'app/myHouse'
 return
]

aboutPageFunction = ($rootScope) ->
 device = ionic.Platform.device()
 $rootScope.currentPlatform = ionic.Platform.platform()
 $rootScope.currentPlatformVersion = ionic.Platform.version()
 $rootScope.manufacturer = device.manufacturer
 $rootScope.model = device.model
 return`

my view:

<ion-view view-title="About">
<ion-content>
    <div class="about-page-inner-container">
        <span>Current platform:{{currentPlatform}}</span>
        <span>Model: {{model}}</span>
        </div>
</ion-content>
</ion-view>