TypeError: Cannot read property 'getCurrentHeading' of undefined

Hello Ionic devs, I have this problem while running the Demo App of ng-cordova by driftyco (https://github.com/driftyco/ng-cordova/tree/master/demo). I attach the pic below about the error. maybe you guys can help me about this. Thanks in advance :smile:

by the way, im running in the demo app about the ‘device orientation’ about the compass. I also try running it in genymotions, it wont display anything upon clicking the ‘Get Current Heading’ button.

I’m guessing you need to install the device-orientation plugin. It’s not super obvious, but every function in the demo requires you to install the appropriate plugin. With Ionic, the command for device orientation is:

ionic plugin add org.apache.cordova.device-orientation

The rest of the plugin install names can be found here:

http://ngcordova.com/docs/plugins/

You are getting this error cause you’re running in your browser. Try to run it in your mobile device. and use the remote control of chrome to watch the console of you mobile browser.