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 #353

Closed
ankitjainOfficial opened this issue Jul 2, 2020 · 6 comments
Closed

Cannot read property 'nativeElement' of undefined #353

ankitjainOfficial opened this issue Jul 2, 2020 · 6 comments
Labels

Comments

@ankitjainOfficial
Copy link

What is the expected behavior?

There should be no error

What is the current behavior?

TypeError: Cannot read property 'nativeElement' of undefined
at GalleryVideoComponent.set pauseVideo [as pauseVideo] (ngx-gallery-core.js:1512)
at setInputsForProperty (core.js:8657)
at elementPropertyInternal (core.js:7703)
at ɵɵproperty (core.js:13788)
at GalleryItemComponent_ng_container_0_gallery_video_2_Template (ngx-gallery-core.js:254)

What are the steps to reproduce?

https://stackblitz.com/edit/angular-ivy-aap6wb

Which versions are you using for the following packages?

Angular: 10
Angular CDK: 10
Angular CLI: 10
Typescript: 3.9
Gallery: 4

Is there anything else we should know?

I don't think so.

Please let me know, if I did a mistake somewhere. Thanks. :)

@MurhafSousli
Copy link
Owner

That's weird especially that it seems to work but still throwing the error

@ankitjainOfficial
Copy link
Author

Yes, this is working. And, I could not find any problems in its working.

@cybercussion
Copy link

cybercussion commented Jul 14, 2020

Same boat here -
[Error] ERROR – TypeError: undefined is not an object (evaluating 'this.iframe.nativeElement')
TypeError: undefined is not an object (evaluating 'this.iframe.nativeElement')
Also getting a lot of -
[Error] Failed to load resource: the server responded with a status of 500 () (log_event, line 0) against YouTube. -- Update ( this was caused by Adguard)

Was using 5.0.0-beta0 getting ahead of v4?

Also notice videos don't always load up, some do and some after some time.

Update- the video not showing up seems to be some view issue. If I Scroll up, then back down I see it appear.

Fixing this with https://stackoverflow.com/questions/41990171/angular-2-not-re-rendering-until-i-click-the-page

For some reason not all the videos were loading up as they were selected or 'slided' to. Adding the ChangeDetectorRef, and adding a subscription to indexChanged helped render the videos.

@GlauberF
Copy link

GlauberF commented Jul 22, 2020

same problem here.
in my case with the error, it is not working

Captura de Tela_selecionar área_20200722142017

Captura de Tela_selecionar área_20200722142048

@MurhafSousli
Copy link
Owner

MurhafSousli commented Jul 22, 2020

@cybercussion I am aware of this, It is not related to the change detection, but it seems to be a browser issue, and it behaves differently in different browsers. it is caused by slide in the new video, try to disable the transition in your global styles and see if the videos load properly

.g-slider {
   transition: transform 400ms cubic-bezier(0.5, 0, 0.5, 1);
}

For this I will investigate a workaround in the future.

@GlauberF Thanks for pointing out, I will fix that soon once I get the time.

@cybercussion
Copy link

Seems somewhat related to vaadin/vaadin-grid#411 and also seems like a issue with a element with a *ngIf on it. The one post further down on that page seemed to wrap some code with a setTimeout (my classic go to when natively coding in JavaScript hah!

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

No branches or pull requests

4 participants