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