Jump to content
Search Community

ERROR TypeError: Cannot read property 'hasAttribute' of null

Zuriel test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

When I am running my angular4 application and i start on a specific route, and navigate to any other route, I get this error


ERROR TypeError: Cannot read property 'hasAttribute' of null

When I search my entire project and all loaded dependencies, one of the files that uses hasAttribute is TweenMax and ScrollMagic.


Does that mean my errors has to be somewhere in TweenMax or ScrollMagic.  It looks like the app is trying to load or find a dependancy, as the error is piped out in the Webpack Bundle right before GSAP starts.


If i start on app.about as my route, and goto app.contact or app.welcome or app.portfolio  I get the hasAttribute error when I leave the about scene.  I destroy a scrollmagic scene on leave but i do that in another place on another route and don't get this cryptic error.


if i start on ANY other route, and goto about and then off about, i never get that error.  


So i guess my question is, do you think this is TweenMax related? assuming that error is thrown? or could there be a possibility that its something with webpack packing tweenmax, or maybe something else not necessarily TweenMax.  I tried to clear the component in that route out to be 100% blank, and it still happens.  The only time it doesnt happen is if i obviously start from another route, or I remove tweenmax and scrollmagic from my app, and then it works again..  i kinda feel this question will be hard to answer without someone just looking at the source 100%, so im not expecting much but just wondering if anything clicks for anyone?   

Link to comment
Share on other sites

found it.   Had a Navigation component with some left over code that refrenced the app-about page.  so when you start with app-about it blows up on exit, but not sure why it works after that, either way, it was a bug and removing that code it works great. so  good to go.


and the left over code was a Scrollmagic scene, so it was indeed something that involved TweenMax (indirectly)/ScrollMagic

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...