2016-12-20 38 views
0

我火腿具有角UI的白手起家日期選擇器 它拒絕調用自定義類閹的問題上通過日期選擇器選項選項或customclass屬性角UI引導日期選擇器沒有要求customclass

代碼如下

供應

div(uib-datepicker 
    ng-model="data.report_end" 
    show-weeks="false"     
    width='300' 
    min-date ="data.report_start" 
    datepicker-options= "end_model_options" 
    ng-click="$event.stopPropagation()" 

的CoffeeScript

scope.end_model_options = 
timezone : 'UTC', 
debounce :300, 
minDate:scope.report_start.utc().toDate() , 
customClass: scope.getDayClass 

scope.getDayClass = (date, mode) -> 
console.log 'getDayClass' 
if mode == 'day' 
dayToCheck = new Date(date).setHours(0, 0, 0, 0) 
i = 0 
while i < scope.events.length 
    currentDay = new Date(scope.events[i].date).setHours(0, 0, 0, 0) 
    if dayToCheck == currentDay 
     return scope.events[i].status 
     i++ 
     return 

回答

0

ui-bootstrap datepicker的文檔說customClass鍵需要一個對象。通過源代碼查看證實了這一點。有可能沒有辦法將函數作爲對象傳遞並期望它執行。

+0

與源代碼有 –

+0

的源代碼已經被使用的功能的plunker是有什麼我缺少的plunker? [鏈接](https://plnkr.co/edit/?p=preview)(抱歉它不會讓我編輯以前的評論) –

相關問題