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? 
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
Post a Comment