-
StackOverflow 文档
-
angular-material2 教程
-
MD-日期选择器
-
与 md-datapicker 绑定数据
日期选择器 - 概述 - example.html 的:
<md-input-container>
<input mdInput
[mdDatepicker]="picker"
[(ngModel)]="date"
placeholder="Choose a date">
<button mdSuffix [mdDatepickerToggle]="picker"></button>
</md-input-container>
<md-datepicker #picker></md-datepicker>
<div>
Date Chosen using 'ngModel':
<div>{{ date }}</div>
</div>
日期选择器 - 概述 - example.ts:
import {Component, OnInit} from '@angular/core';
@Component({
selector: 'datepicker-overview-example',
templateUrl: 'datepicker-overview-example.html'
})
export class DatepickerOverviewExample implements OnInit {
date;
ngOnInit(){
this.date = new Date();
}
}
现场演示