与NG-显示显示选择输入 [英] Select input shown with ng-show
本文介绍了与NG-显示显示选择输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢把重点放在输入它与NG-展示了。然而,这需要一个jQuery调用$消化周期后作出。有谁知道怎么办好code所示后的项目,而不诉诸的setTimeout(),或一些这样的事情吗?
这里的问题的例子普拉克: http://plnkr.co/edit/synSIP? p = preVIEW
I'd like to put the focus on an input after it's shown with ng-show. However, this requires a jquery call to be made after the $digest cycle. Does anyone know how to run code after the item is shown, without resorting to setTimeout(), or some such thing? Here's an example plunk of the issue: http://plnkr.co/edit/synSIP?p=preview
推荐答案
您可以编写一个简单的指令,不需要jQuery的:
You can write a simple directive , dont need jquery :
yourApp.directive('focusme',function(){
return function(scope,elem,att){
elem.focus();
}
});
和您可以使用它是这样的:
and You can use it like this :
<input type="text" focusme>
这篇关于与NG-显示显示选择输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文