How to Debug Angular in Visual Studio Code

Debug in Visual Studio Code with Debugger Extension

Nil Seri
2 min readJan 28, 2021
Photo by Julian Hochgesang on Unsplash

You should first install Debugger for Chrome that you can find here: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome

Restart your Visual Studio Code.

Click the Debug tab on the left:

Click on “create a launch.json file” link that is under “Run and Debug” button.

A variety of options in a drop-down will appear, select Chrome (legacy).

launch.json file with a default content will appear. You can update your “url” here, the way I did.

You can copy paste from here too:

{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"type": "chrome","request": "launch","name": "Launch Chrome against localhost","url": "https://localhost:1932","webRoot": "${workspaceFolder}"}]}

Make sure you started your application from terminal (like “ng serve — configuration=dev — port=1932”).

Once your application is up, click on the green play icon next to your config (make sure your configuration is selected).

A debug toolbar will appear at the top of the screen and chrome will open.

You can put a breakpoint on your .ts file and now you are ready for debugging!

Happy Coding!

--

--

Nil Seri
Nil Seri

Written by Nil Seri

I would love to change the world, but they won’t give me the source code | coding 👩🏻‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

No responses yet