zone.js:140 Uncaught TypeError:无法读取未定义的属性'element'

时间:2017-12-03 17:55:47

标签: javascript html angular angular2-routing zone.js

我正在尝试学习js.当我第一次执行下面的代码时,我没有看到任何错误。当我第二次执行时,我收到以下错误。

  

未捕获的TypeError:无法读取未定义的属性'element'

错误指向此行:

 alert("that.currentPLAYr.element[0].id--->" + that.currentPLAYr.element[0].id);

我的代码:

zone.js: 140 Uncaught TypeError: Cannot read property 'element' of
  undefined
at SafeSubscriber.eval[as _next](PLAYr - conditional.ts: 215)
at SafeSubscriber.__tryOrUnsub(Subscriber.ts: 238)
at SafeSubscriber.next(Subscriber.ts: 190)
at Subscriber._next(Subscriber.ts: 135)
at Subscriber.next(Subscriber.ts: 95)
at Subject.next(Subject.ts: 61)
at PLAYService.validateConditionalEvent(PLAYService.ts: 251)
at PLAYswimmingConditionalRightBar.callPLAYrEvent(PLAY - swimming -
  conditional - right - bar.ts: 3134)
at init.change(PLAY - swimming - conditional - right - bar.ts: 484)
at init.trigger(kendo.all.min.js: 25)

that.PLAYEventDataService = that.PLAYService.conditionalPLAYEventReceived
  .subscribe(params => {
    alert("that.currentPLAYr.element[0].id--->" + that.currentPLAYr
      .element[0].id);
    alert("params.element--->" + params.element);

    if (params.element == that.currentPLAYr.element[0].id) {
      that.template = kendo.template(params.template);
      let eventData = that.timeZoneHandlingNext(params.element,
        params.start, params.end);
      params.start = eventData.start;
      params.end = eventData.end;
      that.PLAYEventReceived = true;
      if (params.changeFrom == "startTimepicker") {
        that.newlySelectedStartTimeFromRightBar = true;
        that.newlySelectedStartTimeFromRightBarValue = params;
      }
      this.isTitleSarch = true;
      that.checkAvailability(params, false, false, "");
      this.isTitleSarch = false;

    }
  })

0 个答案:

没有答案