'device' not defined


Hi all,
i’m writing my first app based on ionic and friends.
I started to generate an application based on sidemenu template.
Then i added a new controller function in which i used the ‘device’ object.
Then I run ‘ionic serve’.
When the page is refreshed I always receive an error: device not defined.
My guess is to use the ‘cordova-plugin-device’ object I found in the project plugin list.

What I’m missing?
I see the ‘console’ object (some console.log(…) calls) used without any particular directives …


‘ionic serve’ runs it locally in a browser. but the ‘device’ object from the cordova-plugin-device plugin is only available on a physical mobile device. (it gives the uuid and other device info, etc…)

So before referring to ‘device’ check -> if(ionic.Platform.isAndroid()){ do it }else{ dont do it}

or something similar!

Hope this helps !! :slight_smile:


Yes !! :grinning:
Now I’m verifing the app with IonicView: which plugins are supported by IonicView?



This is a different question. Please start another thread to discuss “ionicView” because this thread is first and foremost about “device” not being defined.

Thanks :slight_smile: