Debug & Run Angular2 Typescript with Visual Studio Code?

后端 未结 10 1108
情歌与酒
情歌与酒 2020-11-27 10:08

Debug & Run Angular2 Typescript with Visual Studio Code?

I am trying to debug Angular2 typescript application with VS code https://angular.io/gu

10条回答
  •  [愿得一人]
    2020-11-27 10:37

    Sanket's answer was correct but I had some problems with that.

    First, Launch.json is in the ".vscode" directory of the project, and second, port number should be the same as the default server port you use for launching your app. I use ng serve from cmd for launching my project and the default port number was 4200, so I changed the launch.json file as follows.

    {
        // 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": "http://localhost:4200",
                "sourceMaps": true,
                "webRoot": "${workspaceFolder}"
            }
        ]
    }
    

提交回复
热议问题