0

I'm trying to implement a mat datepicker in my project I have already tried almost all examples in angular material documentation

But always get this error:

core.js:6498 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'subscribe')
TypeError: Cannot read properties of undefined (reading 'subscribe')
    at new MatDatepickerInputBase (datepicker.js:3041:1)
    at new MatDatepickerInput (datepicker.js:3286:1)
    at NodeInjectorFactory.MatDatepickerInput_Factory [as factory]

Any idea how to solve this?

I understand the why, because it is not receiving a promise, but how to fix this in the implementation?

I am not sure if it is an issue with the matdatepicker component or with the template variable used for the reference of the mat-datepicker, as when I delete [matDatepicker]="picker" (reference to #picker of , this error disapears, but the component does not achieve to be correctly built.

Thank you

Carlota

0

1 Answer 1

1

Had the same issue today, and managed to fix it. The problem was related to the DateAdapter provider. Take a look at the MatDatepickerInputBase constructor, and you'll see it tries to subscribe to the DateAdapter language/locale change observable.

In my case I had registered a date adapter from a different library. Make sure to register a date adapter that inherits from the Material DateAdapter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.