angularjs - Integrating angular calendar into ionic infinite scroll -


i new enough angular. trying integrate angular-bootstrap-calendar ionic app.

https://github.com/mattlewis92/angular-bootstrap-calendar

i using ‘week’ view instead of incrementing next week using button:

<button class="button ng-model="next" ion-chevron-right btn btn-primary"     mwl-date-modifier    date="calendarday"    increment="calendarview">  </button> 

i trying put horizontal scroll bar using ion-infinite-scroll. if scrolls horizontally, when hits 7th day increments next week above next button does. have been struggling while , wondering if possible without huge amount of work. following markup:

<ion-infinite-scroll direction="y" locking="false" class="calendarcontainer" on-infinite="loadmoredates()">  <mwl-calendar view="calendarview"     current-day="calendarday"     events="events"     view-title="calendartitle"> </mwl-calendar>    </ion-infinite-scroll> 

and controller, wrong - have tried many things already:

myapp.controller('calendarcontroller', function($scope, $rootscope){   $scope.calendarview = 'week';   $scope.calendarday =  new date();   $scope.calendartitle = 'hello';  $scope.loadmoredates = function(){    $scope.next = moment($scope.date).add(1, $scope.increment).todate();   $scope.$broadcast('scroll.infinitescrollcomplete'); } 

i can see following directive used incrementing days. wondering if possible call increment part of directive controller?

 .directive('mwldatemodifier', function() {  return {   restrict: 'a',   controller: function($element, $attrs, $scope, moment) {      function onclick() {       if (angular.isdefined($attrs.settotoday)) {         $scope.date = new date();       } else if (angular.isdefined($attrs.increment)) {         $scope.date = moment($scope.date).add(1, $scope.increment).todate();       } else if (angular.isdefined($attrs.decrement)) {         $scope.date = moment($scope.date).subtract(1, $scope.decrement).todate();       }       $scope.$apply();     }      $element.bind('click', onclick);      $scope.$on('$destroy', function() {       $element.unbind('click', onclick);     });    },   scope: {     date: '=',     increment: '=',     decrement: '='   } };   }); 

i have been battling while , not expecting me, if let me know if doing wrong or if require lot of work? or if point me in right direction great?

this block of code should never work b/c don't have $scope.date , $scope.increment declared anywhere , connected calendar view, right? looks variables connected directive , scoped inside directive, won't work without implementing them in controller.

    $scope.loadmoredates = function(){        $scope.next = moment($scope.date).add(1, $scope.increment).todate();        $scope.$broadcast('scroll.infinitescrollcomplete');     } 

i think should

    $scope.loadmoredates = function(){        //increment calendarday 1 week        $scope.calendarday = moment($scope.calendarday).add(7, 'days').todate();        $scope.$broadcast('scroll.infinitescrollcomplete');     } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

php - Find a regex to take part of Email -

javascript - Function overwritting -