我试图使用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的
1条答案
按热度按时间fhity93d1#
运行
npm install @angular/localize
后解决然后将
import '@angular/localize/init';
添加到polyfills.ts