Angular2的NumericTextBox Kendo UI,带有自定义IntlService

时间:2017-01-20 11:21:50

标签: internationalization kendo-ui-angular2

我为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"));
  }
}

1 个答案:

答案 0 :(得分:0)

您可以在http://forum.lwjgl.org/index.php?topic=2631.0中提交问题。提供一个展示该问题的可运行示例将不胜感激。