HTML:
<ion-view ng-controller="EntryController" class="bg-grey">
<ion-content scroll="true" overflow-scroll="true" class="start-page has-footer" has-bouncing="false">
<div>
<input id="txtEntryInput" type="number" inputmode="decimal" pattern="[0-9]*" ng-model="entryInput" ng-
enter="someActionOnEnter()" />
</div>
</ion-content>
</ion-view>
JS:
app.controller("EntryController", function($scope, $timeout, $http){
//this binds the event when *Done* is pressed on keyboard mobile iOS browser
$timeout(function(){
var entryElement = document.getElementById('txtEntryInput');
if(entryElement) {
entryElement.addEventListener('focusout', function (e) {
$scope.someActionOnEnter();
});
}
});
$scope.someActionOnEnter = function(){
//some ajax call dummy
$http({}).then(function(){
//this is not focusing on element and not showing keyboard on mobile safari, on android it is working
$timeout(function(){
$('#txtEntryInput').focus()
});
});
};
});
I want to show the keyboard right after entry in the input. Its not working on browser.
In ionic app, i am using following configuration:
config.xml
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
ionic-plugin-keyboard 2.2.1 from https://github.com/driftyco/ionic-plugin-keyboard.git
And to show keyboard i am using following code:
$timeout(function () {
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.show();
}
}, 100);
Any help is appreciated, I want to show the keyboard right after entry in the input.