This is for the Ionic / Angular hybrid app. I am trying to fire a shake event using cordova-plugin-shake . It should reload a random image. So far, a random image is displayed during loading, but it does not work when testing the shake event in the simulator.
I get a ReferenceError: shake is not defined error ReferenceError: shake is not defined However, the documents say You do not need to reference any JavaScript, the Cordova plugin architecture will add a shake object to your root automatically when you build. What am I missing here? How can I make this work? I am using cordova ver 6.3.0.
Here app.js
angular.module('TarotApp', ['ionic','ngAnimate']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { if(window.cordova && window.cordova.plugins.Keyboard) {
Here index.html
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <script src="lib/ionic/js/ionic.bundle.js"></script> <script src="lib/angular-animate/angular-animate.min.js"></script> <script src="cordova.js"></script> <script src="js/app.js"></script> </head> <body ng-app="TarotApp"> <ion-pane> <ion-content ng-controller="TarotCtrl"> <img ng-src="img/{{randTarotImg}}.jpg" class="tarot"/> </ion-content> </ion-pane> </body> </html>
source share