Jump to content
GreenSock

Fly

Members
  • Posts

    1
  • Joined

  • Last visited

Fly's Achievements

2

Reputation

  1. Hello, I just want to leave some info about Angular Universal / SSR and GSAP. I was getting the following error: ERROR TypeError: Cannot read property 'querySelectorAll' of undefined I fixed this by checking if the current platform is the browser. Obviously it cannot run on the server. Maybe not the best solution but at least its working for now :) constructor( @Inject(PLATFORM_ID) private platformId: any ) { } ngOnInit(): void { gsap.registerPlugin(ScrollTrigger); } ngAfterViewInit(): void { if (isPlatformBrowser(this.platformId)) { gsap.from('.header__logo', { scrollTrigger: { trigger: '.header__logo', scrub: true, }, y: 600, }); } } I hope this helps someone.
×