如果你想尝试其他的 datepicker,那么你可以使用 ng2-bootstrap 的 datepicker。步骤如下-
使用-npm install --save ng2-bootstrap安装包
安装 moment.js 类型 - typings install moment --save
在 systemjs.config.js 中,您可以像这样更新配置-
map: {
moment: 'node_modules/moment/moment.js'
}
在 Index.html 中添加这一行-
<script src="node_modules/ng2-bootstrap/bundles/ng2-bootstrap.min.js"></script>
DatepickerModule 作为应用程序模块 app.module.ts 中的导入模块
import { DatepickerModule } from 'ng2-bootstrap/ng2-bootstrap';
// or
import { DatepickerModule } from 'ng2-bootstrap/components/datepicker';
在html模板中-
<div style="display:inline-block; min-height:290px;">
<datepicker [(ngModel)]="dt" [showWeeks]="true"></datepicker>
</div>
在组件中你可以像这样设置 dt-
public dt:Date = new Date();
更多详情请参考link