Cannot set empty input by default
See original GitHub issueVersions
- 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:
- Created 3 years ago
- Reactions:1
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found solution, u can set ngModel to undefined, its display your placeholder instead of today date :
In my front :
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 . Please provide a solution Thanks