2017-10-25 12 views
0

月のみを表示するdatepickerがあります。 現在の月のみが表示され、残りの月は無効にする必要があります。はdatepickerに現在の月のみを表示し、残りの月はangularjsを使用して無効にする必要があります

私はmin-datemax-dateで試しましたが、動作しません。

HTML:

<input type="text" class="form-control" 
    readonly="readonly" ng-model="xxxx" 
    min-mode="'month'" min-date="startmnth" max-date="endmnth" 
    datepicker-popup="yyyy-MM" is_open="status.date_opened" 
    ng-required="true" placeholder="YYYY-MM" 
    datepicker-options="datepickerOptions" 
    datepicker-mode="'month'" ng-click="openfromDate($event)" 
    show-button-bar="false"> 

JS:

$scope.startmnth = new Date().getMonth() 
$scope.endmnth = new Date().getMonth() 

$scope.datepickerOptions = { 
    startingDay: 1, 
}; 

$scope.openfromDate = function ($event) {      
    $event.preventDefault(); 
    $event.stopPropagation();   
    $scope.status.date_opened = true; 
}; 
+0

なぜ、タグを使用していないのですか?間違いなくあなたを助けるつもりです –

答えて

0

あなたが追加することができます:あなたのオプションの一部として "dateDisabled this.disabledDates" をし、このような関数を作成:

this.disabledDates = function(data) { 
    var date = moment(data.date); 
    //check date and return true/false to disable/enable 
    return false;//to disable 
} 
関連する問題