How to debug Angular 2 Typescript application using visual code or with the developer tools?
Late to the party, but hope the following helps someone else. The solution will work for angular2 & angular4 = Angular on visual studio code.
Install new extension - Debugger for Chrome

A new folder will be created (automagically) under your project - '.vscode' -> 'launch.json'.

Edit 'launch.json' to reflect as below. Note, port 4200 is default to 'ng serve' adjust if yours is different.
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceRoot}",
"sourceMaps": true
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"webRoot": "${workspaceRoot}",
"sourceMaps": true
}
]
}

HAPPY CODING! :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With