angular / angular/components

docs(datepicker): need better guidance for use with lazy loaded modules

Open
#18,970 11 comments 1 reaction 0 assignees View on GitHub
area: material/datepicker docs P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Reproduction
I created here MyIntl class and I set there only text for calendar open button.
https://angular-material-datepicker-intl.stackblitz.io
https://stackblitz.com/edit/angular-material-datepicker-intl

Steps to reproduce:
1. If you check first calendar button it has aria-label="test" so it works. It works also for second calendar that is in first lazy loadad module
2. But if you click link 'lazy-loaded' and check button for 'other lazy' calendar it's aria-label is default 'Open calendar'
3. It starts to work only if I provide again my custom MyIntl class in OtherLazyModule (commented line)


#### Expected Behavior

I expected that if I provide my custom implementation of MatDatepickerIntl in AppModule it will work also for all lazy loaded modules.
For example MatPaginator works that way.

#### Actual Behavior

Custom implementation of MatDatepickerIntl is not provided in lazy loaded modules

#### Environment

- Angular: 9
- CDK/Material: 9
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Contributor guide

Open the contributing guide

Research direction

Start by running the linked Angular Material Datepicker StackBlitz reproduction and compare the calendars in the root, first lazy-loaded, and OtherLazyModule contexts. Read the MatDatepickerIntl provider usage and the MyIntl implementation, then verify that the custom aria-label is retained in every lazy-loaded module without relying on the commented provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.