How to set focus on element with binding?

后端 未结 9 978
南方客
南方客 2020-12-09 10:23

In Angular2 how can I set binding on element focus. I don\'t want to set it with elementRef. I think in AngularJS there is ngFocus directive In Angular2 there is no such dir

9条回答
  •  臣服心动
    2020-12-09 10:46

    The trick is to use both focus and select together:

    this.(element).nativeElement.focus();
    this.(element).nativeElement.select();
    

提交回复
热议问题