How to set an initial value to daterangepicker?

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to set an initial value to daterangepicker?



I have a DateRangePicker as follows:



HTTP:


<input id="date" name="date" ng-model="FilesDate" class="form-control"/>



JQuery:


$('input[name="date"]').daterangepicker({
opens: 'left'
});



The DateRangePicker works totally fine but when the program initializes, its empty by default. If I remove ng-model, the date initializes properly.




1 Answer
1



Just set the value of your input:


<input value="01/01/2018 - 01/15/2018" id="date" name="date" ng-model="FilesDate" class="form-control" />



http://www.daterangepicker.com/#examples





I've tried that, it doesn't work. It's still empty. Also, I want both dates to be today's date, by default.
– Hassnain Ali
12 mins ago





I just used ng-init and it does display the initial date with it, like this: ng-init= " FilesDate= '01/01/2018 - 01/15/2018' ". What would be the correct syntax to substitute these dates with today's date now dynamically ?
– Hassnain Ali
3 mins ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Xt5GlR7gOJ,7BzLvV5YEviT2gAxYmQljWRkTumsmcU
88ynbOKy1v0e BA

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham