How to achieve this when i close the keyboard to scroll to top of ion–content?
I have found this but indent preformatted text by 4 spaces`how to specyfi witch ion-contet to got to top if i got nested views?
$cordovaKeyboard.automaticScrollToTopOnHiding = true;
You can listen to “native.keyboardhide” and then “$ionicScrollDelegate.scrollTop();”
Check this:
http://ionicframework.com/docs/api/service/$ionicScrollDelegate/
and this
Something like
$window.addEventListener('native.keyboardhide', function(event) {});
Im not sure, but I think you will have to use $scope.$apply, but not really sure about this
do i need to add $window here?
function($scope,$state, $ionicPopup, $timeout,$cordovaKeyboard,$ionicPlatform){
What I would do would be:
myApp.run(function($window, $rootScope) {
$window.addEventListener('native.keyboardshow', function(event) {
$rootScope.$broadcast('native.keyboardshow', event);
});
});
myApp.controller('myController', function($scope){
$scope.$on('native.keyboardhide', function(angularEvent, keyboardEvent) {
//Do something here
console.log(angularEvent, keyboardEvent);
});
});
Hope this help you
myApp.controller('myController', function($scope){
$scope.$on('native.keyboardhide', function(angularEvent, keyboardEvent) {
//Do something here
console.log(angularEvent, keyboardEvent);
});
});
I think you mean keyboardshow not listening keyboardhide:
$scope.$on('native.keyboardshow', function(angularEvent, keyboardEvent) {
//Do something here
console.log(angularEvent, keyboardEvent);
});