Milind
Milind

Reputation: 1955

angularjs responsive datepicker

May be this question is asked lot of time, but I will ask again. I am looking for pure angularjs date picker without jquery and bootstarp. It should be responsive as I am going to use for mobile app in ionic framework.

It should max and min date setting and more than 1 time can be use.

HTML View

<div class="row">
        <div class="item-text-wrap item col col-50">
            <div class="item-icon-left">
                <i class="icon ion-calendar"></i>
                <input type="text" class="dateClass" pick-a-date="depDate" pick-a-date-options="depOptions" placeholder="Departure Date" />
            </div>
        </div>
        <div class="item-text-wrap item col col-50">
            <div class="item-icon-left">
                <i class="icon ion-calendar"></i>
                <input type="text" class="dateClass" pick-a-date="arrDate" placeholder="Arrival Date" />
            </div>
        </div>
    </div>

Controller Code

var minDate = new Date();
        var maxDate = new Date(minDate.getFullYear() + 1, minDate.getMonth(), minDate.getDate());
        $scope.depOptions = {
          format: 'dd/mm/yyyy',
          min: minDate,
          max: maxDate,
          onClose: function(e) {
            alert($scope.depDate);
          }
        }

Now if you see I used $scope.depDate in onClose method but I always get undefined. Actually I am trying make min date for second directive to be the selected date of first directive.

Upvotes: 1

Views: 8764

Answers (2)

Rajeshwar
Rajeshwar

Reputation: 2509

I have create a ionic-datepicker bower component. You can use it. No additional dependencies are required. https://github.com/rajeshwarpatlolla/ionic-datepicker

You can even have a look at the ionic-timepicker bower component. No additional dependencies are required. https://github.com/rajeshwarpatlolla/ionic-timepicker

Upvotes: 5

Nicholas Hirras
Nicholas Hirras

Reputation: 2596

This one looks promising, doesn't seem to require jquery or bootstrap:

https://github.com/alongubkin/angular-datepicker

Upvotes: 1

Related Questions