Input autofocus attribute

后端 未结 10 1540
Happy的楠姐
Happy的楠姐 2020-11-30 04:47

I have places in my code where I have this:


I would like to be able to use it like

10条回答
  •  我在风中等你
    2020-11-30 05:13

    
    
    
    
    
    

    had created above custom directive for one of my use case.

    • always focusses on first input element.
    • works for ajax data, browser back/forward buttons.
    • Tested on chrome and firefox(default autofocus is not supported here)

    JSON.parse is used to parse string "true" returned from html to boolean true in JS.
    another way to use attrs.focus === "true" for if condition.

提交回复
热议问题