I wouldn’t be writing on this forum if I didn’t have a serious problem. I think that I am just overlooking something, but having a second or third eye would help me out a lot. I am trying to get ngCordova to work, but I keep getting “Module ‘ngCordova’ is not available!” in the Chrome browser. Yes, I know that Cordova will not work in Chrome, but even after building and emulating the app in iOS, something still is wrong.
Here is a snippet of my code:
var sample = angular.module('sampleVoice', ['ionic', 'ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
});
sample.controller('RecordVoice', function($scope, $cordovaCapture){
$scope.captureAudio = function() {
var options = { limit: 1, duration: 10 };
$cordovaCapture.captureAudio(options).then(function(audioData) {
// Success! Audio data is here
}, function(err) {
// An error occured. Show a message to the user
});
}
});
Here is the corresponding HTML:
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/lodash/dist/lodash.js"</script>
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
</head>
<body ng-app="sampleVoice">
I know its may not be the issue, but can you try to remove the lodash from your app and test again, the error clearly stated that they cant find the module or the module name is wrong.
Agreed! Wish I could say I didn’t make them any more, but that would be a lie. Don’t know what editor is being used, but a good coloured / syntax highlighted one can make all the difference (Sublime Text in my case - saved my bacon on a load of occasions)
I use Sublime, but I have been thinking about Web Storm. Sublime did not show me the error! … I guess this would be a topic suited better for another forum.
Not that I disbelieve you (we might have different colour schemes / settings after all) but you’re right! Just applied the same edit to my lodash include and I wouldn’t have seen it either: not only that, I would have dismissed a mistype because I “know” Sublime would highlight it. Interesting, not often Sublime drops the ball.
FWIW I started off using (paid) WebStorm - I consider it excellent value for money, and John Lindquist always uses it for the egghead.io videos, so there’s value in that. Just felt like there was a lot of it to get to grips with. Might have to revisit that decision.