Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

Timeline not waiting for data to come from service and throwing errors in console. #6

Closed
Pankesh88 opened this issue May 15, 2018 · 4 comments

Comments

@Pankesh88
Copy link

Cannot read property 'nativeElement' of undefined
at HorizontalTimelineComponent.setDatePosition (horizontal-timeline.component.ts:332)
at HorizontalTimelineComponent.initTimeline (horizontal-timeline.component.ts:246)
at HorizontalTimelineComponent.initView (horizontal-timeline.component.ts:321)
at HorizontalTimelineComponent.set [as timelineElements] (horizontal-timeline.component.ts:103)
at updateProp (core.js:12619)
at checkAndUpdateDirectiveInline (core.js:12326)
at checkAndUpdateNodeInline (core.js:13893)
at checkAndUpdateNode (core.js:13836)
at debugCheckAndUpdateNode (core.js:14729)
at debugCheckDirectivesFn (core.js:14670)

@shalugin
Copy link
Owner

shalugin commented May 15, 2018 via email

@Pankesh88
Copy link
Author

Thank you so much for your response.

Here is the code

In My service:

public getAllData(nms: string): Observable {
return this.http
.get(/api/toy/123);
}

In my component:

timeline: TimelineElements[]

//If I manually set the values here it works

ngOnInit() {
this._dataService.getAllData().subscribe(
data => {
this.timeline = data; // When loading data from here I get the error
},
err => console.error(err),
() => console.info('done loading data'),
);
}

@shalugin
Copy link
Owner

See #3 and #2 any my comment in #2 (comment)

@Pankesh88
Copy link
Author

Thanks I was able to make it work by calling cdr change method after loading data.

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

No branches or pull requests

2 participants