我为Angular2拍摄了最新的RC0 of Kendo UI。它的文档提到了国际化服务的使用。我已经创建了自定义IntlService并在我的App Module中配置了它的提供程序。在组件中如果我使用IntlService依赖项,则调用我的自定义服务,但NumericTextBox不调用我的服务。以下代码有什么问题?
MyIntlService.ts
import { CldrIntlService } from '@progress/kendo-angular-intl';
import { Injectable } from '@angular/core';
@Injectable()
export class MyIntlService extends CldrIntlService {
constructor() {
super("en-US");
console.info('From MyIntlService ctor');
}
formatNumber(value: number, format: string| NumberFormatOptions){
const result = super.formatNumber(value,format);
console.log('In MyIntlService formatNumber');
return result;
}
}
app.module.ts
@NgModule({
imports: [ BrowserModule, InputsModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ],
providers: [{
provide: IntlService,
useClass: MyIntlService
}]
})
export class AppModule { }
app.component
export class AppComponent {
constructor(private intl: IntlService) {
console.log( " From AppComponent " + intl.formatNumber(42, "c"));
}
}