调试步骤:
1.安装nodejs
2.安装vscode
3.vscode安装debugger for chrome插件
4.选择调试->打开调试配置,选择chrome配置,打开lauch.json,修改如下:
{ "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "launch", "name": "Launch Chrome against localhost", "url": "http://localhost:4200", "webRoot": "${workspaceRoot}" } ] }
5.启动项目:npm start
6.vscode打开app.component.ts组件,在app.component.ts的constructor函数中设置断点,在自动打开的浏览器中刷新页面(http://localhost:4200),vscode自动停止断点位置。
7.在vscode的调试控制台中输入this.title,查看组件的变量值