I downloaded the zip file and inside there got tons of file, I guess I only need the ng-cordova.js to be included into the index.html?
I copied ng-corodva.js into my own js file and declared it in index.html
But I’m getting $cordovaPlugin is not defined in my console. Why?
i would suggest install it over bower:
bower install ngCordova
then include the js file under the cordova lib:
<script src="cordova.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
I use manually install, just include the ng-cordova.js, I’ve done it properly I think at that part.
I guess you want to test the IAB: => Ridicoulos stupid doc of ngcordova
You used the wrong name => $cordovaInAppBrowser not $cordovaPlugin!!
here is a workflow for your tests:
-
install ngCordova:
bower install ngCordova
or copy it by your selfe
-
install the plugin:
cordova plugin add org.apache.cordova.inappbrowser
-
check your plugins:
cordova plugin list
-
check if you refered the file right in your index.html
-
require ngCordova in your module.
Here is an example:
angular.module(‘modulname’, [ ‘ngCordova’])
.controller(‘controllername’, function($scope, $ionicPlatform, $cordovaInAppBrowser) {
var pathToSite = 'http://www.domainname.com';
$rootScope.iabIsOpen = true;
var iabDefaultSettings : {
location : 'no',
clearcache : 'no',
toolbar : 'no'
}
$scope.openIAB = function(bcmsBeaconKey) {
$ionicPlatform.ready(function() {
//if is open
if($rootScope.iabIsOpen) {
console.log('APPTEST: iabIsOpen');
return;
}
$cordovaInAppBrowser
.open(pathToSite, '_blank', iabDefaultSettings)
.then(
// success
function(event) {
console.log('on $cordovaInAppBrowser:open success');
},
// error
function(event) {
//start all loops
console.log('on $cordovaInAppBrowser:open error');
$rootScope.iabIsOpen = false;
});
});
});
6.check you networkconnection, IAB needs internet