Update “autofocus” attribute via interaction on template level in angular

后端 未结 2 1727
梦毁少年i
梦毁少年i 2021-01-14 14:35

Having a problem regarding the autofocus attribute in cooperation with Angular. In detail I have a

with an
2条回答
  •  暖寄归人
    2021-01-14 15:11

    Another option is hide the inputs (not use *ngIf else display.style) and reference variables see https://stackblitz.com/edit/angular-sbc4pp?file=src%2Fapp%2Fapp.component.html

        
        

    Your function change like

      change(element:any,index:number)
      {
      this.selection=index;
      setTimeout(()=>{element.focus()},0);
      }
    

提交回复
热议问题