Angular UI Bootstrap datepicker不调用customclass

时间:2016-12-20 15:20:35

标签: angularjs datepicker angular-ui-bootstrap

我的角色ui-bootstraps datepicker存在问题 它拒绝通过datepicker-options选项或自定义类属性

调用它提供的自定义类

下面的代码

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

1 个答案:

答案 0 :(得分:0)

ui-bootstrap datepicker的文档说customClass键需要一个对象。查看源代码确认了这一点。可能无法将函数作为对象传递并期望它执行。