angularUIの日付ピッカーが現在の月を表示しているときに前月のボタンを無効/非表示にし、angularUIの日付ピッカーが現在の月または将来の月を表示していないときに前の月のボタンを有効/表示します。
例:- 現在の月が 6 月の場合、日付ピッカーが 6 月の日付を表示している場合、前月のボタンを無効/非表示にする必要があります。7月または将来の月(8月、9月..)の日付を表示する日付ピッカーの場合、前月のボタンを有効/表示する必要があります
1421 次
1 に答える
0
私もこの問題を抱えていました.Angularでこれを行う方法は実際にはありません.
//Disable the previous month button with monthCount at 0
$(".calendar button[ng-click='move(-1)']").addClass("disabled").attr("disabled","disabled");
var monthCount = 0;
//Decrease monthCount if previous month button isn't already disabled
$(".calendar button[ng-click='move(-1)']").not("disabled").on('click',function(){
monthCount--;
//if monthCount hits 0, disable it
if(monthCount < 1){
$(this).addClass("disabled").attr("disabled","disabled");
}
})
//Increase monthCount on next month button click
$(".calendar button[ng-click='move(1)']").on('click',function(){
monthCount++;
//enable previous month button as long as monthCount is greater than 0
if(monthCount > 0){
$(".calendar button[ng-click='move(-1)']").removeClass("disabled").removeAttr("disabled");
}
})
回答はOPには遅すぎますが、うまくいけば、これにより将来誰かが時間を節約できます。
于 2016-04-08T00:46:54.363 に答える