Reputation: 319
I want to get my Windows username in my angular 8 application's typeScript, is this possible? I found something like this:
let user = new ActiveXObject("WSCRIPT.Network");
console.log(user.UserName.toLowerCase());
When I tried the code, I got 'error TS2340: Can not find the name ActiveXObject'
Is there a way of getting Windows or System username in angular application, if yes, how can one go about the coding?
Upvotes: 1
Views: 7281
Reputation: 1953
Try opening the tsconfig.json
file and adding the "scripthost"
as an element of the "lib"
section:
"lib": [
"es2018",
...
"scripthost"
]
That should make sure the correct library for ActiveXObject is loaded. I found a couple of references to this a possible fix online. Here is one article
Upvotes: 1