title: angularjs directive datepicker jquery year range
body: <p>I am using in my angular application jquery datepicker for a field date of birth, and I need to navigate between year range, but every time I select one year remaining years in the select, ie I have set to -50 years and appear-10years,  and when I select 1993 after subtracting 50 years and left in 1943. </p>
  
  <p>my directive:</p>
  
  <pre><code>DeelezApp.directive('datepicker', function() {
  return {
      restrict: 'A',
      require : 'ngModel',
      link : function (scope, element, attrs, ngModelCtrl) {
          $(function(){
              element.datepicker({
                  dateFormat:'yy-mm-dd',
                  changeMonth: true,
                  changeYear: true,
                  yearRange: "c-50:c-10",
                  onSelect:function (date) {
                      scope.$apply(function () {
                          ngModelCtrl.$setViewValue(date);
                      });
                  }
              });
          });
      }
  }   });
  </code></pre>
  
  <p>as I can do for the year range does not change then select a year?</p>
  
  <p>thanks</p>