我正在尝试the example之后的素材2日期选择器 但我一直收到这个错误
Error: Attempted to open an MdDatepicker with no associated input.
at MdDatepicker.open (material.es5.js:21344)
下面是我的实现
<md-input-container>
<input mdInput
name="dobdate"
(selectedChanged)="onSelectDOBDate($event)"
[(ngModel)]="admissionModel.DOB"
[mdDatepicker]="picker"
placeholder="Choose a Date of Birth">
<button mdSuffix [mdDatepickerToggle]="dobpicker"></button>
</md-input-container>
<md-datepicker #dobpicker></md-datepicker>
答案 0 :(得分:4)
您使用错误的md-datepicker
引用绑定。在[mdDatepicker]="picker"
代码中将[mdDatepicker]="dobpicker"
更改为input
。