如何在AngularJS中获取Kendo日历对象

时间:2016-02-18 10:06:26

标签: javascript jquery angularjs calendar kendo-mobile

这里我尝试为Kendo日历添加滑动功能。我无法检索Kendo日历对象。我如何在控制器中检索Kendo日历对象?

查看页面

<div class="demo-section k-content" >
    <div>
        <kendo-calendar ng-model="datestring" style="width: 100%;"  ng-click="valuefunction(datestring,dateObject)" k-enable-swipe="true" k-on- swipe="myTouch.swipe(kendoEvent)" k-ng-model="dateObject"></kendo-calendar>
    </div>
</div>

控制器

$scope.myTouch = {
    swipe: function(e) 
    {  
        if(e.direction=="left")
        {
            (here i need to access kendo calendarobject).navigateToFuture();
        }
        else if(e.direction=="right")
        {
            (here i need to access kendo calendarobject).navigateToPast(); 
        } 
    }
}

1 个答案:

答案 0 :(得分:0)

查看页面:

<div class="demo-section k-content" > <div> <kendo-calendar kendo-touch ng-model="datestring" style="width: 100%;" k-rebind="datestring" ng-click="valuefunction(datestring)" k-enable-swipe="true" k-on-swipe="myTouch(kendoEvent,datestring)" ></kendo-calendar> </div> </div>

控制器页面

$ scope.myTouch = function(e,datestring){

if (e.direction == "left") {

  datestring.setDate(datestring.getDate() + 30);
  $scope.datestring = datestring;
  // $scope.month=datestring;
  console.log(datestring);
  console.log('swipeleft');
}

// $scope.datestring.navigateToFuture();
else if (e.direction == "right") {

  datestring.setDate(datestring.getDate() - 30);
  $scope.datestring = datestring;
  // $scope.month=datestring;
  console.log(datestring);
  console.log('swiperight');
}

};