Using RescalingTool in Angular

Hello I tried to follow the instructions on a forum that touches this subject but have not had success implementing the RescalingTool in Angular, Rescaling with gojs-angular. I’ve tried two options and both have 2 different errors. Either way, I’d appreciate some direction on how to implement Extensions in Angular projects.

First option: Importing Rescaling Tool from node_modules
When I import {RescalingTool} from 'gojs/extensionsTS/RescalingTool'; and call the new RescalingTool()

Result: Error in console

ROR TypeError: gojs_extensionsTS_RescalingTool__WEBPACK_IMPORTED_MODULE_2__.RescalingTool is not a constructor  

Second Option: Copy Rescaling Tool locally
The link I posted above seems to imply that I need to copy the file locally and call the RecalingTool from my local file. So I copy the file from the extensionsTS folder and create my own.

import { RescalingTool } from 'src/app/shared/rescaling-tool';

Result:

error TS2345: Argument of type 'RescalingTool' is not assignable to parameter of type 'Tool'.  Types of property 'diagram' are incompatible.

In your src/app/shared/rescaling-tool.ts file, make sure that it imports exactly the same GoJS library file that the rest of your code does.

1 Like

This worked thank you. The node_module has the import coming from import * as go from 'gojs/release/go-module.js'; and changing the import to import * as go from 'gojs'; solved the issue. Thanks again.