AngularJS + Fullcalendar发送错误TypeError:无法读取未定义的属性“ __id”

科利莫尔

我在我的网站上使用angular-ui-calendar。在控制器中,我这样写:

    define(['underscore'], function (_) {
    "use strict";

    var SearchController = function ($scope, $location, OrdersService, UsersService) {

        /* config object */
        $scope.uiConfig = {
            calendar: {
                height: 450,
                editable: true,
                firstDay: 0,
                monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
                monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
                dayNames: ['Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado'],
                dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab'],
                header: {
                    left: '',
                    center: 'title',
                    right: ''
                }
            }
        };
        $scope.eventSources = [$scope.events];

        var getTecnicians = function () {
            UsersService.getTechs().then(function (techs) {
                $scope.technicians = techs;
            });
        };

        var search = function () {
            var searchObject = $scope.$$childHead.searchForm;
            UsersService.getCurrentStatus(searchObject.technician._id, searchObject.selectedStartDate).then(function (result) {
                $scope.states = result[0].states;
                for (var i = 0; i < $scope.states.length; i++) {
                    var event = {};
                    if (i === $scope.states.length - 1) {
                        event = {
                            title: $scope.states[i].status,
                            start: $scope.states[i].date,
                            allday: true
                        };
                    } else {
                        event = {
                            title: $scope.states[i].status,
                            start: $scope.states[i].date,
                            end: $scope.states[i + 1].date
                        };
                    }
                    $scope.events.push(event)
                }
                if (result) {
                    $scope.haveData = true;
                }
            });
        };

        var init = function () {
            $scope.search = search;
            $scope.getTecnicians = getTecnicians();
            $scope.haveData = false;
            $scope.events = [];
        };
        init();
    };

    SearchController.$inject = ["$scope", "$location", "OrdersService", "UsersService"];

    return SearchController;
});

当我单击按钮时,我会执行获取请求并从服务器获取数据,对其进行处理并生成事件objets并将其放入我的范围。

完成后,日历会显示此错误:

ypeError: Cannot read property '__id' of undefined
    at sourcesFingerprint (http://localhost:8000/bower_components/angular-ui-calendar/src/calendar.js:48:24)
    at Object.changeWatcher.getTokens (http://localhost:8000/bower_components/angular-ui-calendar/src/calendar.js:88:21)
    at Scope.$get.Scope.$digest (http://localhost:8000/bower_components/angular/angular.js:12243:40)
    at Scope.$get.Scope.$apply (http://localhost:8000/bower_components/angular/angular.js:12516:24)
    at done (http://localhost:8000/bower_components/angular/angular.js:8204:45)
    at completeRequest (http://localhost:8000/bower_components/angular/angular.js:8412:7)
    at XMLHttpRequest.xhr.onreadystatechange (http://localhost:8000/bower_components/angular/angular.js:8351:11) 

我需要在事件上加上_id吗?

用户名

我遇到了同样的错误,一种解决方法是,初始化事件数组$ scope.events = [],然后发出http请求

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

AngularJS + Fullcalendar发送错误TypeError:无法读取未定义的属性'__id'

来自分类Dev

angularjs添加值无法设置未定义的属性“ id”

来自分类Dev

Angularjs / Ionic TypeError:无法读取未定义的属性“ then”

来自分类Dev

AngularJS:TypeError:无法读取未定义的属性“ get”

来自分类Dev

AngularJS:TypeError:无法读取未定义的属性“ then”

来自分类Dev

TypeError:无法读取AngularJS上未定义的属性“ get”

来自分类Dev

AngularJS-TypeError:无法读取未定义的属性“ go”

来自分类Dev

TypeError:无法读取AngularJS上未定义的属性“ get”

来自分类Dev

错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“ id”

来自分类Dev

错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“ id”

来自分类Dev

AngularJS-Bootstrap TypeAhead中的错误:TypeError:无法读取未定义的属性“ length”

来自分类Dev

AngularJS错误:无法读取未定义的属性“ get”

来自分类Dev

AngularJS类型错误:无法读取未定义的属性“ GET()”

来自分类Dev

错误 AngularJs:无法读取未定义的属性“then”

来自分类Dev

UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“ id”

来自分类Dev

Gatsby TypeError-无法读取未定义的属性“ id”

来自分类Dev

MERN-TypeError:无法读取未定义的属性“ id”

来自分类Dev

Angular Material TypeError:无法读取未定义的属性“ id”

来自分类Dev

UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“ id”

来自分类Dev

JWT-TypeError:无法读取未定义的属性“id”

来自分类Dev

core.js:6406错误TypeError:无法读取未定义的属性“ id”

来自分类Dev

angularjs无法读取未定义的属性

来自分类Dev

AngularJS'无法读取未定义的属性'then'

来自分类Dev

AngularJS:无法读取未定义的属性”

来自分类Dev

AngularJs无法读取未定义的属性“ then”

来自分类Dev

在AngularJS =“无法读取未定义的属性'then'

来自分类Dev

angularjs无法读取未定义的属性

来自分类Dev

Angularjs - 无法读取未定义的属性“then”

来自分类Dev

无法读取未定义的属性“ id”

Related 相关文章

  1. 1

    AngularJS + Fullcalendar发送错误TypeError:无法读取未定义的属性'__id'

  2. 2

    angularjs添加值无法设置未定义的属性“ id”

  3. 3

    Angularjs / Ionic TypeError:无法读取未定义的属性“ then”

  4. 4

    AngularJS:TypeError:无法读取未定义的属性“ get”

  5. 5

    AngularJS:TypeError:无法读取未定义的属性“ then”

  6. 6

    TypeError:无法读取AngularJS上未定义的属性“ get”

  7. 7

    AngularJS-TypeError:无法读取未定义的属性“ go”

  8. 8

    TypeError:无法读取AngularJS上未定义的属性“ get”

  9. 9

    错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“ id”

  10. 10

    错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“ id”

  11. 11

    AngularJS-Bootstrap TypeAhead中的错误:TypeError:无法读取未定义的属性“ length”

  12. 12

    AngularJS错误:无法读取未定义的属性“ get”

  13. 13

    AngularJS类型错误:无法读取未定义的属性“ GET()”

  14. 14

    错误 AngularJs:无法读取未定义的属性“then”

  15. 15

    UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“ id”

  16. 16

    Gatsby TypeError-无法读取未定义的属性“ id”

  17. 17

    MERN-TypeError:无法读取未定义的属性“ id”

  18. 18

    Angular Material TypeError:无法读取未定义的属性“ id”

  19. 19

    UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“ id”

  20. 20

    JWT-TypeError:无法读取未定义的属性“id”

  21. 21

    core.js:6406错误TypeError:无法读取未定义的属性“ id”

  22. 22

    angularjs无法读取未定义的属性

  23. 23

    AngularJS'无法读取未定义的属性'then'

  24. 24

    AngularJS:无法读取未定义的属性”

  25. 25

    AngularJs无法读取未定义的属性“ then”

  26. 26

    在AngularJS =“无法读取未定义的属性'then'

  27. 27

    angularjs无法读取未定义的属性

  28. 28

    Angularjs - 无法读取未定义的属性“then”

  29. 29

    无法读取未定义的属性“ id”

热门标签

归档