【问题标题】:NumericTextBox Kendo UI for Angular2 with custom IntlService带有自定义 IntlService 的 Angular2 的 NumericTextBox Kendo UI
【发布时间】:2017-01-20 23:20:36
【问题描述】:

我已经为 Angular2 获取了最新的 RC0 剑道 UI。它的文档提到使用国际化服务。我已经创建了自定义 IntlService 并在我的应用程序模块中配置了它的提供程序。在组件中,如果我使用 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"));
  }
}

【问题讨论】:

    标签: internationalization kendo-ui-angular2


    【解决方案1】:

    您可以在GitHub repository ↗ 中提出问题。提供一个可运行的示例来演示该问题将不胜感激。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多