shalugin / horizontal-timeline

Horizontal Timeline Component on Angular2
MIT License
39 stars 21 forks source link

Asynchronous filling the timeline results in an empty timeline #2

Open geoffreyvd opened 7 years ago

geoffreyvd commented 7 years ago

As the title says: when i fill the timeline with elements at an asynchronous time, the timeline will not render. any ideas?

shalugin commented 7 years ago

I think it's because component fills only in ngAfterViewInit.

sggonzalezg commented 7 years ago

I'm having the same problem.

geoffreyvd commented 7 years ago

I fixed it, will push or create a PR tonight or PM me if u need it fast

sggonzalezg commented 7 years ago

Please 🙏

geoffreyvd commented 7 years ago

@sggonzalezg ngAfterViewChecked(): void { console.log(" after view is triggerd"); if(this.isInputChanged){ if (this.timelineElements && this.timelineElements.length) { for (let i = 0; i < this.timelineElements.length; i++) { if (this.timelineElements[i].selected) { this.selectedIndex = i; break; } } this.initTimeline(this.timelineElements); } } this.isInputChanged = false; }

and implement afterviewchecked

geoffreyvd commented 7 years ago

@sggonzalezg did it work?

sggonzalezg commented 7 years ago

@geoffreyvd

Sorry, I don't know hot to do that. I'm new in this. Can you explain to me step by step?

Thanks