question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error if using AOT: "Cannot read property 'set' of undefined"

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Sorry, will will not be able to answer every support request.  Please consider other venues for support requests

Current behavior This is my component code:

<div ngxDroppable="'page'" [model]="newForm.controls">
      <div *ngFor="let control of newForm.controls; index as i; last as isLast" ngxDraggable="['page']" [model]="control">
        <iqz-saf-form-section-edit [allControls]="newForm.controls" [section]="control" [totalSections]="newForm.controls.length" [currentSectionIndex]="i" (actionClicked)="handleSectionAction($event, i)"></iqz-saf-form-section-edit>
        <div *ngIf="!isLast" class="field">
          <div class="control">
            <input class="is-checkradio is-small is-rtl" type="checkbox" id="{{'pagebreak_' + i}}" [value]="i" (change)="togglePagebreak(i)" [checked]="newForm.pageBreakIndices.indexOf(i) != -1" />
            <label for="{{'pagebreak_' + i}}">Break to new page here</label>
          </div>
        </div>
      </div>
    </div>

The drag and drop feature works totally fine when using JIT compilation. However, if I compile via AOT, I get the following error in the browser console when visiting the page:

ERROR TypeError: Cannot read property 'set' of undefined
    at DrakeStoreService.register (drake-store.service.js:24)
    at DroppableDirective.ngOnInit (ngx-droppable.directive.js:50)
    at checkAndUpdateDirectiveInline (core.js:12351)
    at checkAndUpdateNodeInline (core.js:13878)
    at checkAndUpdateNode (core.js:13821)
    at debugCheckAndUpdateNode (core.js:14714)
    at debugCheckDirectivesFn (core.js:14655)
    at Object.eval [as updateDirectives] (new-intake-form.component.html:33)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:14640)
    at checkAndUpdateView (core.js:13787)

Expected behavior AOT should work the same way as JIT.

Please tell us about your environment: Angular version: 5.2.0 Typescript version: 2.4.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] all

  • Language: [all | TypeScript X.X | ES6/7 | ES5] all

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
rdavidsoncommented, Jan 25, 2018

@rajshrimohanks Yes, we are currently using 3.1.0 and don’t see the issue.

2reactions
rajshrimohankscommented, Jan 25, 2018

@rdavidson

When i rollback to version v3.1.0 in my package.json i dont get this issue.

Can confirm that this doesn’t exist in v3.1.0. I’m temporarily rolling back to it. Thanks for the tip.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AOT: Error: Uncaught (in promise): TypeError: Cannot read ...
I am trying to publish an Angular4 front-end project in AOT production build. After long hours of getting angular cli to successfully build...
Read more >
Ahead-of-time (AOT) compilation - Angular
Use the non-null type assertion operator to suppress the Object is possibly 'undefined' error when it is inconvenient to use *ngIf or when...
Read more >
Popup throws the "Cannot read property 'show' of undefined ...
I have debugged AOT application using sourcemaps . I have that dxPopup is not loading. I am able reproduce in sample applications. Here...
Read more >
ERROR in Cannot read property &#38;#039;length&#38
Can you give more information about this: ERROR in Cannot read property 'length' of undefined ? Try to update "screenfull": "^3.3.0" to latest...
Read more >
Angular 8 Webpack Aot Build Failed - Cannot Read Property ...
If you're using a library affected by this error, you should upgrade your @angular/cli version to 8 or disable optimization in production mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found