Angular2+ autofocus input element

后端 未结 10 2029
走了就别回头了
走了就别回头了 2020-12-07 18:24

How can I autofocus input element? Similar to this question, but not with AngularDart. Something like this:



        
10条回答
  •  Happy的楠姐
    2020-12-07 19:19

    I know this is an old post but for others looking for a newer answer: I was using an angular material dialog and it was auto-selecting the close button not the input.

    Using cdk-focus-start (part of the CDK) fixes this ... with no additional code.

提交回复
热议问题