Angularjs 为什么可以';我在Firefox中绑定到角度模型的输入中输入文本吗?
我无法在firefox的输入中输入文本。同样的代码在chrome上运行良好。我没有面临任何css问题。我没有使用jquery 下面是我的html代码Angularjs 为什么可以';我在Firefox中绑定到角度模型的输入中输入文本吗?,angularjs,html,firefox,Angularjs,Html,Firefox,我无法在firefox的输入中输入文本。同样的代码在chrome上运行良好。我没有面临任何css问题。我没有使用jquery 下面是我的html代码 <div class="todo_content" style="width:66%"> <input class="todo_add_input" autofocus="autofocus" placeholder="Please Add Task" ng-model="addtask
<div class="todo_content" style="width:66%">
<input class="todo_add_input" autofocus="autofocus"
placeholder="Please Add Task"
ng-model="addtask.activity_title" id="task-title">
</div>
渲染时,它会生成低于html的代码
<div class="todo_content" style="width:66%">
<input class="todo_add_input ng-pristine ng-valid ng-empty ng-touched"
autofocus="autofocus" placeholder="Please Add Task"
ng-model="addtask.activity_title" id="task-title"
aria-invalid="false" style="">
</div>
为什么,相同的代码在firefox中不起作用?试试这个
使用指令
app.directive('autoFocus', function($timeout) {
return {
restrict: 'AC',
link: function(_scope, _element) {
_element[0].focus();
}
};
});
<input name="theInput" auto-focus>
app.directive('autoFocus',函数($timeout){
返回{
限制:“AC”,
链接:函数(_范围,_元素){
_元素[0]。焦点();
}
};
});
更多详细信息:的可能副本也请检查:@RameshRajendran:因为您提供的第一个链接基于jquery。我要了安格拉斯。我搜索了很多问题,但没有找到正确的答案。关于第二个链接,我的firefox版本是最新的,但我仍然面临这个问题。@georgeawg:我没有面临任何css问题。所有的css都应用正确,除了我不能在文本框中输入文本!!分而治之。一次删除一个属性,直到问题消失,然后再添加最后一个部分。这将让我们知道是哪个属性导致了问题。尝试了您的解决方案后,我删除了html5的自动聚焦属性,并将此指令添加到我的应用程序中。对于chrome来说,这是有效的,但对于firefox来说却没有!!!