TypeError: Cannot read property 'length' of undefined full clandar

时间:2016-04-04 17:10:00

标签: javascript jquery angularjs fullcalendar

I have problem on full calandar in angularsjs.

code :

 var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        $scope.events = [];
        $scope.eventSources = [];
         angular.forEach($scope.ObjectMeilleurPrix, function (x) {
             var dateday = y + '-' + m + '-' + x.Ordre;
             $scope.events.push({
                 title: '20',
                 start: dateday,
             });
           });

         console.log($scope.events);
         $scope.eventSources = [$scope.events];
         console.log($scope.eventSources);       

erreur : TypeError: Cannot read property 'length' of undefined at Object.getTokens (calendar.js:103) at Scope.$digest (angular.js:16087) at Scope.$apply (angular.js:16359) at done (angular.js:10791) at completeRequest (angular.js:10989) at XMLHttpRequest.requestLoaded (angular.js:10930)

**thank you**

2 个答案:

答案 0 :(得分:2)

I'm guessing the error is on line 103

But I would also check line 42 as that's often the cause of errors

答案 1 :(得分:0)

Provide any code you have so we can help better. Meanwhile you can take a look at this- seems to be a similar problem.