Hi Ionic-Forum,
I need help with the steps to add ngCordova to my ionic projekt for android devices. Specifically i want to use the $cordovaMedia to play sounds.
So far i
- added the cordova media plugin (which shows up in the plugins folder)
- included js/ng-cordova.js in index.html (between ionicbundle.js and cordova.js). File is placed in projectfolder/www/js/
- i added a dependency to the app.js => angular.module(‘name’, [‘ionic’, ‘ngCordova’, ‘name.controllers’, ‘name.services’])
- i tried adding the dependency to the controller module too => angular.module(‘name.controllers’, [‘ngCordova’])
- and i added it the specific plugin to the controller => .controller(‘SendCtrl’, function($scope, $state, $http, $cordovaMedia, dataservice) {
i tested this on my android device (physical device), where it worked before adding ngCordova. Then i tested it as a local browser view (although as far as i understand it cordova plugins wont work in browser view).
my browser throws the following error:
“Uncaught Error: [$injector:modulerr] Failed to instantiate module farts due to:
Error: [$injector:modulerr] Failed to instantiate module ngCordova due to:
Error: [$injector:nomod] Module ‘ngCordova’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.”
=> not sure if this is relevant since cordova plugins should not work in browsers, right?
Any steps i’m missing? I read about $ionicReady to catch unitialized plugins, but i didnt understand it so far and im not sure if it matters, since i the only usage of the module beside the dependency injection is tied to a button click on a screen after the login screen.
Any advice is highly appreciated, this is the third sunday i’am trying to solve this.