question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can i use two MdDatepicker in one component?

See original GitHub issue

This is my code :

<md-input-container class="example-full-width">
      <input class="full-width" mdInput formControlName="JoinDateUtc" [mdDatepicker]="picker" placeholder="Join Date">
      <md-datepicker-toggle mdSuffix [for]="picker"></md-datepicker-toggle>
      <md-datepicker #picker></md-datepicker>
</md-input-container>

<md-input-container class="example-full-width">
      <input class="full-width" mdInput formControlName="LeftDateUtc" [mdDatepicker]="picker" placeholder="Left Date">
      <md-datepicker-toggle mdSuffix [for]="picker"></md-datepicker-toggle>
      <md-datepicker #picker></md-datepicker>
</md-input-container>

and i get an error : Error: An MdDatepicker can only be associated with a single input.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ziaongitcommented, Jan 9, 2018

@willshowell just use different ID for each Example:

<md-input-container class="example-full-width">
      <input class="full-width" mdInput formControlName="JoinDateUtc" [mdDatepicker]="picker" placeholder="Join Date">
      <md-datepicker-toggle mdSuffix [for]="picker"></md-datepicker-toggle>
      <md-datepicker #picker></md-datepicker>
</md-input-container>

<md-input-container class="example-full-width">
      <input class="full-width" mdInput formControlName="LeftDateUtc" [mdDatepicker]="pickerTo" placeholder="Left Date">
      <md-datepicker-toggle mdSuffix [for]="pickerTo"></md-datepicker-toggle>
      <md-datepicker #pickerTo></md-datepicker>
</md-input-container>

I changed the ID to pickerTo at three places

[mdDatepicker]="pickerTo"
mdSuffix [for]="pickerTo"
<md-datepicker #pickerTo>
0reactions
angular-automatic-lock-bot[bot]commented, Sep 29, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Override Angular Material 2 MdDatepicker's top or left offset ...
I would like to find a way to either override this with CSS (I can not figure that out) or import he MdDatepicker...
Read more >
Pickers - KivyMD's documentation - Read the Docs
When creating an instance of the MDDatePicker class, you must pass as a parameter a method that will take one argument - a...
Read more >
Directives > mdDatepicker - AngularJS Material
Parameter Type Description ng‑change expression expression Expression evaluated when the model value changes. ng‑disabled boolean boolean Whether the datepicker is disabled. ng‑required boolean boolean Whether a...
Read more >
Datepicker | Material Dashboard 2 React @ Creative Tim
The MDDatePicker component helps you to simply create a beautiful date picker. It uses react-flatpickr in base and you can use all of...
Read more >
KivyMD Date Picker - Python Kivy GUI Tutorial #51 - YouTube
In this video I'll show you how to use the KivyMD Date Picker for Kivy and ... We can set a default day,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found