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.

Cannot set empty input by default

See original GitHub issue

Versions

  • Angular version: 8
  • component version: 2.1.9

Describe the bug I want to set the input with empty and placeholder, but it always display to current date. I tried to set ngModel with startDate and endDate with null value but not success.

<input class="form-control date-select" type="text"
	id="filter-date"
	ngxDaterangepickerMd
	[(ngModel)]="filter_date"
	[showCustomRangeLabel]="true"
	[alwaysShowCalendars]="true"
	[ranges]="ranges"
	[linkedCalendars]="true"
        opens = "right"
	[isInvalidDate] = "isInvalidDate"
	[locale]="{format: 'DD MMM YYYY', firstDay: 1}"
	[showClearButton]="true"
	(datesUpdated)="filterDate()"
	placeholder="Select date...">  
this.filter_date = {
            "startDate": null,
            "endDate": null
        }

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
mbenfrihacommented, Nov 15, 2020

I found solution, u can set ngModel to undefined, its display your placeholder instead of today date :

Capture d’écran 2020-11-15 à 11 48 29 Capture d’écran 2020-11-15 à 11 49 08

In my front : Capture d’écran 2020-11-15 à 11 49 31

0reactions
anupam42commented, Nov 5, 2020

Hello I am facing issue while setting default value when i am adding 7 days as default it is taking as custom range option only but when i disable timePicker it takes as 7 days but its fails Screenshot 2020-11-05 at 8 02 57 PM . Please provide a solution Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default value if input field empty - Stack Overflow
Define value attribute in your input field but this will show your default value in text field <form method = "GET" action="search.php"> ...
Read more >
Set default values for fields or controls - Microsoft Support
This article explains how to set a default value for a table field or for a control on a form in an Access...
Read more >
3 Ways to Set Default Value in JavaScript | SamanthaMing.com
Let's break down the 3 different ways to set Default Values using logical operator ... Falsy Values false undefined null NaN 0 ""...
Read more >
Set default values for blank fields in Zaps - Zapier
With the default value text transformation in Formatter, you can set a fallback value for fields that may not always have a value......
Read more >
Behavior with empty inputs and default values
we noticed the same: Null or emtpy will be interpreted as null. On the other hand your are not able to assign ''...
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