預設為今年 var date = new Date; $scope.year = date.getFullYear(); //年份減 $scope.yearPrev = function(){ $scope.year -- ; ... ...
預設為今年 var date = new Date; $scope.year = date.getFullYear(); //年份減 $scope.yearPrev = function(){ $scope.year -- ; if($scope.year == 1999){ showTips('超出選擇範圍!'); $scope.year ++; } } //年份加 $scope.yearNext = function(){ $scope.year ++; if($scope.year == 2031){ showTips('超出選擇範圍!'); $scope.year --; } };