Search code examples
javascriptangularjsmomentjspikaday

Angular Pikaday configuration


I tried to implement Angular Pikaday to my project, however, i cannot set options of the Pikaday directive. I don't what to implement it globally, especially for minDate or maxDate options. When i try with getting the element by ID it works fine.

I would like to know what i am missing.

$scope.myPickerObject = {
    firstDay: 1, // not showing
    numberOfMonths: 2, // not showing
    onSelect: function() {
      alert('hi');
    }

  };
     //$scope.myPickerObject = new Pikaday({   //  onSelect: function() {   //    alert('hi');   //  }   //  Doesn't work either   //});/

Fiddle


Solution

  • You are not providing pickaday a callback, you should define on-select method on input itself like shown in the

    Fiddle: http://plnkr.co/edit/X10a4peeKQK2uj30mJQk?p=preview

    If you want to configure specific input