angular - How to set same md-checkbox focus outline for all focus sources -


when md-checkbox focused using keyboard, there's outline around it. when focus set programmatically, there no visual indicator. there way make same? enter image description here

ripple click/focus event. if want have ripple effect after setting checkbox programmatically, need focus element code. need add reference control.

in template, add reference variable checkbox e.g. customcheckbox:

<md-checkbox [(ngmodel)]="checked" #customcheckbox>check me!</md-checkbox> 

... , in code, need call focus() method on control:

// import mdcheckbox in ts file import { mdcheckbox } '@angular/material';  // declare customcheckbox in class @viewchild('customcheckbox') private customcheckbox: mdcheckbox;  // use line focus checkbox programmatically want. this.customcheckbox.focus(); 

link working demo.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -