Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Issue with plugin method

  • In my index.html I have:
    ons.ready(function() {
    var navigator = document.getElementById(‘navigator’);
    var button = document.getElementById(‘push-button’);

          button.onclick = function() {
          alert('En Dev0 Ready');
          var watchID   = navigator.compass.getCurrentHeading( 
              function OK1(heading) {
              function onErr(e){
                     alert ('Error: ' + e.code);});
          alert('En Dev1 Ready');


    and I got an error Uncaught TypeError: Cannot call method ‘getCurrentHeading’ of undefined

    For sure, I have enabled the plugin “Device Orientation”

    Can you tell me what my stupid mistake is ?
    I’m rather lost.

  • How are you testing the app? Have you compiled the app with the plugin? Are you using Monaca Cloud, VisualStudio, or some other IDE?