Facing problem with autofocus attribute

Hey there!! I’ve got a little problem with the framework and I don’t know if it’s a bug which need to be corrected or something I’m doing wrong, so I want to share :slight_smile:

It is when I use the attribute “autofocus” on an form’s input.

I use a ion-nav-view system for my app, and when I enter in the view with this attribute, the animation’s view goes too much to the right, and move back to the left a to be right centered.

I tested without the autofocus’ attribute -> it works perfectly.
I also tested with this syntax : autofocus=‘true’ ->it does not work neither

Idon’t know if it is something about the framework, or if it’s me which use something bad…

Any ideas?

Hi there, I´m facing exactly the same issue as @Mxman06 with the autofocus attribute.

@Mxman06 were you able to resolve this?

Thanks.

try using this directive

<input ... auto-focus />
    .directive('autoFocus', function ($timeout) {
        return {
            restrict: 'A',
            link: function ($scope, $element) {
                /*$scope.$on('$ionicView.afterEnter', function () {
                    alert("pok");
                });*/
                $timeout(function () {
                    $element[0].focus();
                }, 1000);
            }
        }
    })