typescript ngx-datepicker头为空

bbmckpt7  于 2023-08-08  发布在  TypeScript
关注(0)|答案(1)|浏览(110)

我试图使用ngx-datepicker,但无论我做什么,都得到了空的标题(datepicker导航部分)。

预期结果:

https://i.stack.imgur.com/4dBOO.png

当前结果:

https://i.stack.imgur.com/UMjnY.png
https://i.stack.imgur.com/yhpOu.png

我的日期选取器组件代码:

  • 模板代码:

第一个月

  • 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 {
  }
}

字符串

  • 依赖性:
"@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"

编辑:

以下是该问题的最小复制:
https://stackblitz.com/edit/angular-ivy-w83mcv?file=src/app/app.component.ts

fhity93d

fhity93d1#

运行npm install @angular/localize后解决
然后将import '@angular/localize/init';添加到polyfills.ts

相关问题