-
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
Cannot read property 'slick' of undefined #24
Comments
the same for me |
ngx-slick.umd.js In which there are two code blocks: so the real problem is if we are using "slick" inside OneComponent and then we are navigating to TwoComponent, then due to routing OneComponent get destroys along with our "slick" configuration variable. |
This is a duplicate of #6 You can use the ngIf structural directive to only include the element or component containing the carousel if there is at least one slide. |
depiction:you answer always same. The problem born when leave a view that has a slide for a new view. Do you explain me how I should use that ngif? I have a template:
If a click on element a, it crash. |
@Feof In my application I get this error if a user tries to navigate to another view (regardless of whether or not the new view has a carousel or not) before slide data has been received. The following code worked for me. I'm getting slide data from an API in the parent component. Once a response from the API has been received, I set loaded to true and pass the slides array to my carousel component.
|
Your context is very specific. |
When creating a component using the Angular CLI, the component's selector, by default, is always "app-[component-name]". Feel free to try my technique, which requires moving the carousel to a separate component. |
Also I have a separate component. I have </ component> and inside ngx-slick. you use that slides, I do not know what to do. However, I think the author left the project. |
I'm using the slider inside of a modal that may or may not be opened, and I get the error when navigating if the modal was never opened, so there are some unique factors. Preferably, the library would be changed to null check before calling unslick. But I got around it for now with this kludge-y bit of code: ` ngAfterContentInit() {
|
Closed. open new issue if any question. |
Hi.
If there are no items in the slick element we get the error "Cannot read property 'slick' of undefined" when try to leave the page.
You should check for undefined in unslick() method
The text was updated successfully, but these errors were encountered: