swemkg
swemkg

Reputation: 117

Autofocus not working with AngularAgility

Here is a plunker link of my code where it's shown that autofocus doesn't work http://jsfiddle.net/05hq7shr/118/

<div ng-form="exampleForm" class="form-horizontal">
    <input type="text" autofocus type="text" aa-field-group="myName" required />
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-3">
            <button aa-submit-form="save()" class="btn btn-default">Save</button>
        </div>
    </div>
</div>

Upvotes: 0

Views: 86

Answers (2)

Pardeep Jain
Pardeep Jain

Reputation: 86790

Strange , Don't know the reason but by removing

aa-field-group="myName"

from the input filed focus will work

Upvotes: 1

Sachila Ranawaka
Sachila Ranawaka

Reputation: 41445

using javascript you can focus the input on page load.

window.onload = function() {
  document.getElementById("autoInput").focus();
};

<input type="text"  id="autoInput"  type="text" aa-field-group="myName" required />

demo

Upvotes: 1

Related Questions