Comments (9)
So, now you can use provideNativeDateTimeAdapter
function as provider and override MAT_TIME_LOCALE
for each component separately. Tested it on your stackblitz. It works.
Implemented in:
15.3.0
16.3.0
17.5.0
from ngx-mat-timepicker.
Did you try the approach below?
import { LOCALE_ID, NgModule } from '@angular/core';
@NgModule({
imports: [
// ...
],
providers: [{ provide: LOCALE_ID, useValue: "en-GB" }],
})
export class MyModule {}
from ngx-mat-timepicker.
@dhutaryan yes zero effect still using en-US
from ngx-mat-timepicker.
No-no, override LOCALE_ID
from ngx-mat-timepicker.
That one would work, but I want to have possibility to control config just for time picker, because our modules differ in business logic requirements, so they need to be configurable based on provided config.
I'm thinking that proposed solution should fix the issue.
from ngx-mat-timepicker.
Actually even when I override LOCALE_ID
it isn't working. Maybe it takes value from RootInjector
and ignoring ComponentInjector
value. So the only working option form me currently is to replace provider for TimeAdapter
.
from ngx-mat-timepicker.
That one would work, but I want to have possibility to control config just for time picker, because our modules differ in business logic requirements, so they need to be configurable based on provided config.
Make sense. Anyway, this works for me:
import { LOCALE_ID, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatNativeDateTimeModule, MatTimepickerModule } from 'mat-timepicker';
@NgModule({
declarations: [
],
imports: [
CommonModule,
MatTimepickerModule,
MatNativeDateTimeModule,
],
providers: [
{
provide: LOCALE_ID,
useValue: 'pl-PL',
},
],
})
export class MyModule {}
from ngx-mat-timepicker.
@dhutaryan I figured out how to make it work, but it's kinda hacky. I just reporting bug.
Here is reproduction what exactly isn't working: https://stackblitz.com/edit/stackblitz-starters-pgbyuy?file=src%2Fmain.ts
Angular have hierarchical dependency injection tree. Currently only value from RootInjector
is respected and used. Overriding value in other parts of hierarchy isn't respected. Usually for most projects it's doesn't matter, but there are also those big ones with complicated business logic, that are using those advanced patterns and features.
from ngx-mat-timepicker.
So, this is related to one feature that I wanted to implement. I'd like to make implementation closer to standalone API. It should help.
from ngx-mat-timepicker.
Related Issues (20)
- [Bug] Touchmove event doesn't work on dials HOT 1
- [Bug] Close button is visible sometimes HOT 1
- [Bug] Remove autofocus on dial hour for inline mode HOT 1
- [Bug] No min/max attributes if no form binding HOT 1
- [But] MatTimepickerInputEvent is not exported HOT 1
- [Bug] Timepicker toggle is enabled if input is disabled HOT 1
- M3 support? HOT 2
- [Bug] Attributes and controls HOT 3
- Special characters and input controls in dial mode HOT 1
- Allow only numbers in dial mode HOT 13
- Add support for virtual keyboards (mobile) HOT 2
- 🚨Library styles affects global styling HOT 4
- Support Angular v18 HOT 2
- NativeDateTimeAdapter parseTime ignores AM and PM HOT 5
- Contributions HOT 2
- Keyboard mode is unusable with keyboard HOT 8
- Clock View needs double click on hour to switch to minute on Android/iOS HOT 9
- In keyboard mode can't type using numpad HOT 7
- A11Y: Closing timepicker does not return focus to previously focused element HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-mat-timepicker.