Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'nativeElement' of undefined #8

Open
Inexad opened this issue May 4, 2020 · 5 comments
Open

Cannot read property 'nativeElement' of undefined #8

Inexad opened this issue May 4, 2020 · 5 comments

Comments

@Inexad
Copy link

Inexad commented May 4, 2020

Hi,

Thanks for quick update regarding section pop/push and more.

I've upgraded the package and now i get following error:

image

Can this be due to mismatch of Angular version ? I'm using 9.1.2.

Regards.

@abhishekjain12
Copy link
Owner

@Inexad Can you be more specific when you are getting this error? I setup a project with your specified angular version and it is working fine.

@Inexad
Copy link
Author

Inexad commented May 25, 2020

Hi,

This i use in markup:
<ngx-ts [items]="items" [periods]="periods" [sections]="sections" [events]="events" [showBusinessDayOnly]="true" [allowDragging]="true"></ngx-ts>

In constructor i do:

    this.events.SectionClickEvent = (section) => { console.log(section); };
    this.events.ItemClicked = this.itemClicked.bind(this);
    this.events.ItemDropped = (item) => { console.log(item); };
    // this.events.ContextMenuEvent = (item, event) => { console.log(item); };

    this.periods = [
      {
        name: '1 day',
        timeFramePeriod: (60 * 1),
        timeFrameOverall: 0,
        timeFrameHeaders: [
          'Do MMM',
          'HH'
        ],
        classes: ''
      },
      {
        name: '3 days',
        timeFramePeriod: (60 * 2),
        timeFrameOverall: (60 * 24 * 2),
        timeFrameHeaders: [
          'Do MMM',
          'HH'
        ],
        classes: 'period-3day'
      }, {
        name: '1 week',
        timeFrameHeaders: ['MMM YYYY', 'DD(ddd)'],
        classes: '',
        timeFrameOverall: 1440 * 7,
        timeFramePeriod: 1440,
      }, {
        name: '2 week',
        timeFrameHeaders: ['MMM YYYY', 'DD(ddd)'],
        classes: '',
        timeFrameOverall: 1440 * 14,
        timeFramePeriod: 1440,
      }];
  }

In ngOnInit() i add sections and items to arrays. Then i use service.refresh() to update the timeline.

The error is:
image

For some reason it cannot find it's elementref.

Regards.

@Inexad
Copy link
Author

Inexad commented May 25, 2020

This is most likely due to that items & sections are empty array at constructor ? However, then this should still work, right ?

@abhishekjain12
Copy link
Owner

@Inexad This specific case is also working fine for me.

@carlitoxenlaweb
Copy link
Contributor

Algo got this but was the render executing before xhr request (set values), a simple ngIf isLoaded variable fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants