-
Notifications
You must be signed in to change notification settings - Fork 46
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
initSlick() #7
Comments
@rsmachir If you use *ngFor syntax with slides variable like below code (example code in README),
You can change the number of slides via append/pop to
|
Thank you for your prompt reply. My slides are actually two sets of *ngFor array of objects with data that comes from my API. Seeing your reply, all I had to do was explicitly empty out the array on navigation and let it re-populate from the API. That did the trick. |
@rsmachir Can you try to assign api's result array directly to
|
Which is what I had originally. The challenge I ran into with that is, when I navigate and the API result set changes slide show freezes mid-stream.
|
@rsmachir Thanks for reporting the issue. Can you add your ts code part (http request / assign part) for me? After that, i will check it immediately. (tip) if slick performance is important, please consider to use trackBy syntax in *ngFor. |
this.mortgagecompanyservice = this.mort.GetMortgageCompanies(this.UrlInfo$.DBACode, this.UrlInfo$.MetroId).subscribe((m: iMortgageCompany[]) => {this.mortcomps$ = m}, error => this.errorMessage = error);
I will add trackBy and see if that helps with the performance. I'll get back to you, if it does. Thank you. |
@rsmachir It's weird. It seems work in test code. Did you set your component's change detection strategy as OnPush ? |
No I just used the default. I'm getting much better performance by setting trackBy for *ngFor. Now I ran into another issue, this is a big site, so all my modules are being lazy loaded. On some of my lazy loaded components I have second slide-show on them. On these the main one loaded in the app works fine, but the one lazy loaded one has slight second or two hesitation before auto play kicks in. Any tricks to making the second more smoother - Thank you.
|
I can get it to perform better without hesitation if set VariableWidth to false in the configuration. But that leaves wide swaths of white space between the slides. Anything I'm missing in my config.
|
@rsmachir Sorry for late comment. I found that if initialize slick in ngAfterViewChecked, angular changeDetector wait for rendering slick until next I fix the cause with 9e0031c - add ngAfterViewInit call for initializing slick. I can't certain it will resolve your issue. Can you check the problem with ngx-slick-carousel 0.4.1 ? |
Thank you. That update helped. Getting a much stable performance from it now. |
I have a slide show in the my app.component, the number of slides might change as user navigates through the site, I call initSlick() in ngAfterViewChecked, however it keeps adding to existing slides not re-initializing just with new slides, it keeps appending to what ever is already there, What other technique can we use to re-initialize on route navigation.
The text was updated successfully, but these errors were encountered: