Reputation: 137
I'm in trouble and found no answer, my object windows.cordova.plugin this undefined need to access the keyboard, apparently my code is correct. I use Visual Studio 2015 and Last version cordova(5.3) and IONIC(1.1).
Thanks in advance
HTML
<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">
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="starter">
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</body>
</html>
APP.JS
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('login', {
url: '/login',
templateUrl: 'templates/login.html',
controller: 'LoginCtrl'
})
.state('home-page', {
url: '/home',
templateUrl: 'templates/home.html',
controller: 'HomeCtrl'
})
$urlRouterProvider.otherwise('/login');
});
Upvotes: 4
Views: 6435
Reputation: 137
I found the error, I created the project in the wrong way , creating a new project " cord apache " in Visual Studio 2015 community and added the " NuGet " the IONIC , then found the solution as follows I created a project by cmd for command iONIC "start ionic ... " . This generated a doubt can not create a direct IONIC project in Visual Studio 2015? equal the cord Apache ???
Upvotes: 2
Reputation: 1485
You can check if the plugin is well installed in the platform inspecting the file
/plugins/{platform}.json
for exemple for android the file is
/plugins/android.json
and check the value of installed_plugins
...
"installed_plugins": {
"com.ionic.keyboard": {
...
},
...
}
Upvotes: 3
Reputation: 231
The code looks right. How did you test your application? Did you run on an actual device? If you tested on the browser, it will be undefined. If the problem persists, try to remove and add the plugin again:
$cordova plugin remove ionic-plugin-keyboard
$cordova plugin add ionic-plugin-keyboard
$cordova prepare
Then try running on your device.
Upvotes: 1