Ionic / Angular hybrid app, issue with getting a shake event working
<p>This is for a Ionic/Angular hybrid app. I'm trying get a <code>shake event</code> to fire using <a href="https://github.com/leecrossley/cordova-plugin-shake" rel="nofollow">cordova-plugin-shake</a>. It's supposed to reload a random image. So far a random image is showing up on load, but it's not working when testing a <code>shake event</code> in the simulator. </p>

<p>I'm getting the error <code>ReferenceError: shake is not defined</code> However the docs say <code>You do not need to reference any JavaScript, the Cordova plugin architecture will add a shake object to your root automatically when you build.</code> What am I missing here? How can I get this to work? I'm using cordova ver 6.3.0.</p>

<p>Here's app.js</p>

<pre><code>angular.module('TarotApp', ['ionic','ngAnimate'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.cordova &amp;&amp; window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
    shake.startWatch(onShake, 40);
  });
})

angular.module('TarotApp')
    .controller('TarotCtrl', function ($scope) {

        $scope.tarotImg = ['1', '2', '3', '4', '5', '6'];

        $scope.randTarotImg = $scope.tarotImg[Math.floor(Math.random() * $scope.tarotImg.length)];


});

var onShake = function () {
  $scope.randTarotImg = $scope.tarotImg[Math.floor(Math.random() * $scope.tarotImg.length)];
};
</code></pre>

<p>Here's index.html</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"&gt;
    &lt;title&gt;&lt;/title&gt;

    &lt;link href="lib/ionic/css/ionic.css" rel="stylesheet"&gt;
    &lt;link href="css/style.css" rel="stylesheet"&gt;

    &lt;!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    &lt;link href="css/ionic.app.css" rel="stylesheet"&gt;
    --&gt;

    &lt;!-- ionic/angularjs js --&gt;
    &lt;script src="lib/ionic/js/ionic.bundle.js"&gt;&lt;/script&gt;
    &lt;script src="lib/angular-animate/angular-animate.min.js"&gt;&lt;/script&gt;

    &lt;!-- cordova script (this will be a 404 during development) --&gt;
    &lt;script src="cordova.js"&gt;&lt;/script&gt;

    &lt;!-- your app's js --&gt;
    &lt;script src="js/app.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body ng-app="TarotApp"&gt;

    &lt;ion-pane&gt;

     &lt;!--  &lt;ion-header-bar class="bar-stable"&gt;

      &lt;/ion-header-bar&gt;--&gt;

      &lt;ion-content ng-controller="TarotCtrl"&gt;


            &lt;img ng-src="img/{{randTarotImg}}.jpg" class="tarot"/&gt; 


      &lt;/ion-content&gt;

    &lt;/ion-pane&gt;



  &lt;/body&gt;
&lt;/html&gt;
</code></pre>