Having quite a bit of trouble integrating ngCordova within my Ionic App, specifically for managing the Splashscreen.
I’ve installed the Cordova “Splashscreen” plugin:
cordova plugins list
reports:
...
org.apache.cordova.splashscreen 0.3.2 "Splashscreen"
I’ve updated my defaults.xml to reflect:
<preference name="AutoHideSplashScreen" value="false" />
I’ve added the JavaScript library (from the GitHub repo), directly before cordova.js:
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
I’ve added ngCordova
to app.js
within the angular.module
requires:
var app = angular.module('ionicApp', ['ionic', 'ngCordova'])
I’m passing $cordovaSplashscreen
to app.run
.run(function($ionicPlatform, $state, $cordovaSplashscreen) {
However, within run() I am unable to use the show() or hide() methods. I get the following console error:
Uncaught TypeError: Cannot read property 'show' of undefined
If I console.log() the $cordovaSplashscreen object, I get:
Object {hide: function, show: function}hide: function () {arguments: nullcaller: nulllength: 0name: ""prototype: Object__proto__: function Empty() {}<function scope>show: function () {__proto__: Object app.js:6
I see the show() and hide() methods… they look naked.
Also, the tutorial demonstrates using $cordovaSplashScreen (note the uppercase Screen) where I’ve found that simply does not work. $cordovaSplashscreen seems to get me a bit further but I’m at a complete loss.
Also, using the ngCordova “Custom Build” option is trash. I wish they’d test these things?!?! You’ve got to get the ngCordova lib from GitHub apparently.
Thanks for any help!