我是Angular的新手,对提供商覆盖有疑问.我想在我的项目https://www.npmjs.com/package/mydatepicker中使用这个日期选择器.
我想覆盖此库的组件使用的语言环境提供程序.以下是https://plnkr.co/edit/fS8IoJqB8PYvgNEVGIMY示例.
我从库类(my.locale.service.ts)扩展了LocaleService,并希望使用它而不是它,所以我在我的模块中指定了它:
providers: [{provide: LocaleService, useClass: MyLocaleService }]
Run Code Online (Sandbox Code Playgroud)
但它不起作用,组件仍然使用它自己的LocaleService.我怎样才能做到这一点?
谢谢!
angular ×1