rajat chauhan
rajat chauhan

Reputation: 21

Cannot find namespace 'go'

I am integrating gojs in angular 8 project.

I have already installed gojs-angular package.

npm install gojs gojs-angular.

Below is the code snippet.

public initDiagram(): go.Diagram {};

Error:Cannot find namespace 'go'

Upvotes: 1

Views: 365

Answers (2)

D4LI3N
D4LI3N

Reputation: 380

Could be only one of these 3 things

Either didn't install GoJS properly:

npm install gojs gojs-angular

Didn't import it properly: (most likely this, based on the error type)

import * as go from 'gojs';

Or its missing from package.json:

"dependencies": { "gojs": "^3.0.11" }

Upvotes: 0

rajat chauhan
rajat chauhan

Reputation: 21

Please follow and verify below steps.

  1. Install gojs and gojs-angular

npm i gojs gojs-angular

  1. import * as go from 'gojs';

We can just use variable by import in the component.ts file.

No need to add script or import in other places,

Upvotes: 1

Related Questions