providers: [ { provide: LOCALE_ID, useValue: "bs-BA" }]
我想添加这个在bosnian中获取月份名称,但不工作。任何建议?如何在Angular 2中的DatePipe中设置区域bs?
providers: [ { provide: LOCALE_ID, useValue: "bs-BA" }]
我想添加这个在bosnian中获取月份名称,但不工作。任何建议?如何在Angular 2中的DatePipe中设置区域bs?
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LOCALE_ID } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ],
providers: [
{ provide: LOCALE_ID, useValue: 'bs-BA' },
],
})
export class AppModule { }
在
在组件
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
{{date | date: 'd MMMM y'}}
`
})
export class AppComponent {
date = new Date(1988, 2, 15);
}
IM已经使用代码从后 – None
好让我查 – Robert
嗨,我们可以这样做https://stackoverflow.com/a/40090356/7261317 – Robert