我正在寻找一个在Angular2中的日期时间选择器, - 我有一个datetimepicker使用HTML5通过设置输入类型作为日期和这个工程。 但是,它不符合我的要求,因为我需要根据今天的日期减去5天设置思维,maxdate是今天 - 运行时验证。所以不能在HTML中真正硬编码值。Angular2日期时间选择器建议
试图使用ngbDatepicker但它没有奏效。
任何建议真的很感激。
下面是我的代码,同时试图使用ngbDatePicker: -
App.module.shared.ts
import { Component, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
declarations:
[
AppComponent
],
imports:
[
CommonModule,
NgbModule.forRoot()
]
DateComponent.ts
export class DateComponent implements OnInit
{
public model : Date;
}
DateComponent.html
<form [formGroup]="myForm">
<div>
<div class="input-group">
<input class="form-control" placeholder="dd-mm-yyyy" name="dp"
[(ngModel)]="model" ngbDatepicker #d="ngbDatepicker" [ngModelOptions]="
{standalone: true}">
<div class="input-group-addon" (click)="d.toggle()" >
<i class="glyphicon glyphicon-calendar" aria-hidden="true"></i>
</div>
</div>
请点击在日历上不显示datetimepicker
“ngbDatepicker”中的“没有工作”,究竟是什么? –
请提供演示您尝试完成的代码,您尝试的内容以及失败的位置。 –