I am going crazy here. I'm a newbie in ionic developing, and trying to install ANY plugin for a week now... So to get it simple, here is what I did both locally on Git Bash and also tried running from Linux server.
1. NodeJs installed
2. Cordova installed, tried it with verions 5.4.1, 6, 6.1
3. Ionic 1.7.14 installed
4. ionic start sideApp sidemenu - success
5. android platform added
6. bower install ngCordova - success
index.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">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.min.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>
<script src="js/controllers.js"></script>
</head>
<body ng-app="starter">
<ion-nav-view ></ion-nav-view>
<div ng-controller="PlaylistsCtrl"></div>
</body>
Controller
angular.module('starter', ['ionic', 'ngCordova'])
.controller('PlaylistsCtrl', function($ionicPlatform, $scope, $cordovaDevice, $window) {
$ionicPlatform.ready(function() {
if ($window.cordova)
alert('$window.cordova available');
else
alert('$window.cordova NOT available');
if ($window.cordova.plugins)
alert('$window.cordova.plugins available');
else
alert('$window.cordova.plugins NOT available');
});
})
Then ionic upload
, and when checking on phone, no matter what I do I get the alert Not avalialble
What am I missing? Is it some compatibility issue with some versions, or what could I be missing?? I am trying to get this solved for a literally a week now... Thanks!
I'm guessing you're checking via Ionic View application, right (because you mentioned ionic upload
)?
You can't use that with plugins (the same way most plugins don't work via browser). No, you can't, and no there's no workaround, it's just not meant to work with that.
If you already do have an app in the app store and you're trying to deploy the hot code push via the ionic upload
, then also please bare in mind that you first have to send an update with new plugins (plugins are binary files), and only then would you again be able to use hot code push (deploy).
Bottom line, you should test your plugins via the actual phone with ionic run
, or via emulator with ionic emulate
.