title: zone.js:140 Uncaught TypeError: Cannot read property 'element' of undefined
body: <p>I am trying to learn js.When I execute the below code for first time I am not seeing any error.When I execute second time I am getting the below error.</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'element' of undefined</p>
  </blockquote>
  
  <p>Error is pointing to this line:</p>
  
  <pre><code> alert("that.currentPLAYr.element[0].id---&gt;" + that.currentPLAYr.element[0].id);
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>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 =&gt; {
      alert("that.currentPLAYr.element[0].id---&gt;" + that.currentPLAYr
        .element[0].id);
      alert("params.element---&gt;" + 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;
  
      }
    })
  </code></pre>