I resolved this issue.
I can work with my application in two modes Launch or Attach.
In the first case (launch) I had to do:
1.) I added configuration in launch.json for launch mode like below:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
}
]
}
Details:
Most important is set good port in url. I had to set 4200 port because it's default port for ng serve (https://angular.io/cli/serve).
2.) I had to compile my application. I can do it via terminal in Visual Studio Code like below:
or I can do it via cmd like below:
3.) I installed "Debugger for Chrome" extention via marketplace like below:
After this 3 steps I added some breakpoint and could run (F5) my application in debug mode
like below:
In the second case (attach) I had to do:
1.) I added configuration in launch.json for attach mode like below:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"webRoot": "${workspaceFolder}",
}
]
}
2.) I installed "Debugger for Chrome" extention via marketplace.
3.) I set remote debugging ("--remote-debugging-port=9222") for Chrome application like below:
Details:
Path for my Chrome "target":
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
4.) I started that Chrome which had remote debugging in path of "target".
Be careful!
If you have Chrome icon on taskbar, you have to add remote debugging newly!(it's stupid I know).
5.) After this 4 steps I added some breakpoint and could run (F5) my application (before it, you have to compile project - step 2 in first example!)
in debug mode and everything works.
Now when I have to work with angular project I am compiling project via VSCode or cmd, I am starting Chrome in remote debugging on localhost:4200 and creating some front-end. When something is wrong, I am launching attach via VSCode and I can debug.