I am trying to use ngx-datepicker but whatever I do am getting the header(datepicker navigation section) empty.
expected outcome:
current result:
my date picker component code:
template code:
<ngb-datepicker #dp [(ngModel)]="model" (navigate)="date = $event.next"></ngb-datepicker>
component.ts
import { Component, OnInit } from '@angular/core';
import {NgbCalendar, NgbDateStruct} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-date-picker',
templateUrl: './date-picker.component.html',
styleUrls: ['./date-picker.component.scss']
})
export class DatePickerComponent implements OnInit {
model: NgbDateStruct;
date: {year: number, month: number};
constructor(private calendar: NgbCalendar) {
}
ngOnInit(): void {
}
}
dependencies:
"@angular/animations": "~11.1.2",
"@angular/common": "~11.1.2",
"@angular/compiler": "~11.1.2",
"@angular/core": "~11.1.2",
"@angular/forms": "~11.1.2",
"@angular/platform-browser": "~11.1.2",
"@angular/platform-browser-dynamic": "~11.1.2",
"@angular/localize": "11.0.9",
"@angular/router": "~11.1.2",
"@ng-bootstrap/ng-bootstrap": "^9.1.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"bootstrap-with-rtl": "^1.0.3",
"ngx-pagination": "^5.0.0",
"ngx-select-ex": "^6.0.2",
"ngx-webstorage": "^7.0.1",
"bootstrap": "^4.5.3",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
Edit:
here is a minimal reproduction of the issue:
https://stackblitz.com/edit/angular-ivy-w83mcv?file=src/app/app.component.ts
solved after running npm install @angular/localize
then adding import '@angular/localize/init';
to polyfills.ts