angularjs 自动对焦在 mozilla firefox 中不起作用

angularjs autofocus is not working in mozilla firefox

请查看 jsfiddle link http://jsfiddle.net/ounsqcmt/55/

我曾像这样使用自动对焦 angularjs

它在 google 中工作,但在 mozilla firefox

中不工作

代码如

<div ng-app="App" ng-controller="AppCtrl ">
    <form>

        <input type="text" />
        <input name="theInput" auto-focus />

    </form>


</div>

var app = angular.module("App", []);

app.controller("AppCtrl", function($scope) {

})

app.directive('autoFocus', function($timeout) {
    return {
        restrict: 'AC',
        link: function(_scope, _element) {
            $timeout(function(){
                _element[0].focus();
            }, 0);
        }
    };
});

以上代码在 googlechrome 和 Internet Explorer 中有效...但在 mozilla firefox 中无效...

请帮帮我..

提前致谢

var app = angular.module("App", []);

app.controller("AppCtrl", function($scope) {
       
})
app.directive('autoFocus', function($timeout) {
    return {
        restrict: 'AC',
        link: function(_scope, _element) {
            $timeout(function(){
             window.focus()
                _element[0].focus();
            }, 0);
        }
    };
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="App" ng-controller="AppCtrl ">
    <form>
        
        <input type="text" />
        <input name="theInput" auto-focus />
        
    </form> 
</div>