How to install license in Angular 4 app


We have an angular 4 app, and I ws wondering how do I install the license for the app?


I assume you have read

You need to assign go.licenseKey after importing go.js but before creating any Diagram.

so I just add this line with the license key in the beginning of the TS file before starting the diagram code? or in the app.ts file? where is the recommended location for it.

also if we have an unlimited license, is the process the same?

Yes, I think that would work. Does it work for you?

Yes, the procedure for unlimited domains includes all of the same steps, but has some more in the instructions that we send you.

tried adding it in a script tag on the top of the index.html - no go
if I put it in the ngOnInit, i get:
Cannot assign to ‘licenseKey’ because it is a constant or a read only property?

In a script tag at the start of index.html is obviously too early – no libraries have loaded yet.

That compiler error message does not make sense to me. Did you do what suggests?

thanks - I missed the (go as any) part, as soon as I added it, all works well

Hi @idekkers,

I am facing the same issue as you were facing but I didn’t received any solution.
1.When I use go.licenseKey that time I am getting Cannot assign to ‘licenseKey’ because it is a constant or a read only property? error.
2.When I use (go as any).licenseKey that time I am getting illeagal reassignment to import ‘go’ error.

Please suggest any alternatives to solve this issue. (I am using GoJs 1.8.x with Angular 7)

@sbhopi I have no idea why that wouldn’t work. Can you send me the code you’re using by email? gojs at

Hi There,

We started refactoring our solution to be in a mono repository structure Nx Angular.

After applying our license key in the component ngOnInit() the evaluation watermark still persists, and
I cannot figure out why the key is not being applied.

Please see example of component here, I’ve also created a sample application to replicate the issue.

Tiny URL Link

I compressed the application in a zip file.

To run the application

please unzip.

  1. npm i
  2. ng serve some-app --host=some-host note host flag not needed but, serving as localhost works but as specified domain does not, our license are licensed to run on unlimited domains.
  3. The application renders showing the watermark.

Both MyInternalDiagramComponent as well as MyComponentComponent displays the watermark

my-component.component.ts and my-internal-diagram.component.ts both have the following line in them:

(go as any).licenseKey = 'LicenseKeyGoesHere'; //Not Being Applied

It appears that you have not substituted the license key string that you should have received via email from our server after submitting

Hi Walter,

Thanks for the response.

The ‘LicenseKeyGoesHere’ is where my actual license will go yes,but it is just a place holder for my actual production license as I did not think it would be wise to upload source containing my licence to a public forum.

Hi Walter,

Is there anything else I can try to resolve the issue?

I had sent you email yesterday. Let’s continue there.