How to set an initial value to daterangepicker?

Multi tool use


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 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.
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