我在我的angular应用程序中使用jquery datepicker作为出生日期字段,我需要在年份范围之间导航,但每次我在select中选择一年剩余年份时,即我已将其设置为-50年并显示为-10年,当我在减去50年后选择1993年并在1943年离开时。
我的指令:
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);
});
}
});
});
}
} });如我所能做的年份范围不变,那么选择一个年份?
谢谢
发布于 2014-06-21 03:02:53
我找到了!
只需更改此行即可
yearRange: "c-50:c-10"
至
yearRange: "-50:-10"谢谢
https://stackoverflow.com/questions/24331242
复制相似问题