0
HTML代码TS文件格式化其通过自举ngbDatepicker选择在角2
<form novalidate [formGroup]="udpateObj">
<div class="form-group">
<label for="HDresolutionDate">Resolution Date:</label>
<input type="text" id="date" formControlName="DateP" ngbDatepicker
#d1="ngbDatepicker">
</div>
<form>
代码中的时间
let dateVal = backendDate;// am getting date obj from backend and
this.udpateObj= new FormGroup({
DateP: new FormControl(dateVal)
});
我需要显示其从后端来的时间或者从dd/mm/yyyy格式的日期选择器中选择。
必须有您使用日期在日期选择器的格式选项。如果没有什么,那么你必须改变手动形式的日期使用javascript –
有没有原因你不会使用'NgbDateParserFormatter'?根据他们的文档。 https://ng-bootstrap.github.io/#/components/datepicker – silentsod