Jump to content
Search Community

Draggable-Angular: Property '_gsTransform' does not exist on type 'HTMLElement'

marcodellabate 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

Hello,
I'm building an application with Angular 6 that includes Draggable. I've imported Draggable successfully and the application works perfectly but I keep getting this typescript error:
 

error TS2339: Property '_gsTransform' does not exist on type 'HTMLElement'.

How can I get rid of this irritating error?
Thanks!

Link to comment
Share on other sites

Hm, it's tough to troubleshoot blind - is there any way you could post a reduced test case, perhaps as a codepen? Also, are you trying to access _gsTransform directly on an element (yourself)? If so, make sure that GSAP has applied a transform to that element because _gsTransform gets added the first time GSAP must apply a transform-related value. You can even do something as simple as:

//doesn't actually change anything, but ensures that _gsTransform exists on the element
TweenMax.set("#element", {x:"+=0"}); 

 

  • Like 2
Link to comment
Share on other sites

import 'gsap';

import TweenMax from 'gsap';
import Draggable from 'gsap/Draggable';


These are the imports, and this is a small portion of the code that uses _gsTransform

 

 Draggable.create("#foo", {
      type: "rotation",
      bounds:{ minRotation:0, maxRotation:270 },
      onDrag: function () {
        angle = $("#foo")[0]._gsTransform.rotation; 


tell me if you need something more

Link to comment
Share on other sites

It shouldn't make any difference, but I'm curious if you get the same result with this change:

 

angle = this.target._gsTransform.rotation;

 

As Jack mentioned, a demo would be quite helpful in troubleshooting this for you.

 

 

  • Like 2
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...