angular material 2 date picker auto open on focus

mdDatepicker provides method open() in order to open it manually doe developers. You can invoke it at md-input‘s focus event. See docs(Method of MatDatepicker).

  <input mdInput [mdDatepicker]="picker" (focus)="" placeholder="Choose a date">
  <button mdSuffix [mdDatepickerToggle]="picker"></button>
<md-datepicker #picker></md-datepicker>

Demo(included demo for opening on focus and opening in typescript)

Leave a Comment