从Visual Studio运行Angular4

时间:2017-11-06 14:46:50

标签: angular asp.net-core

我制作了一个简单的Web应用程序,后端在.net core 2.0中完成,前端在angular4中完成。 enter image description here

如果我想启动我的应用程序,我应该打开cmd或power shell并编写npm start。在那一刻,应用程序正在启动,浏览器正在打开。

但是如果我想用ctrl + f5运行应用程序或者只是从VS运行F5,那么当时浏览器正在打开并且应用程序没有启动,就像在后台运行npm一样。 这是来自package.json

的代码
{
  "version": "1.0.0",
  "name": "mypackage",
  "private": true,

  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "dependencies": {
    "@angular/common": "^4.4.5",
    "@angular/compiler": "^4.4.5",
    "@angular/core": "^4.4.5",
    "@angular/forms": "^4.4.5",
    "@angular/http": "^4.4.5",
    "@angular/platform-browser": "^4.4.5",
    "@angular/platform-browser-dynamic": "^4.4.5",
    "@angular/router": "^4.4.5",
    "core-js": "^2.5.1",
    "rxjs": "^5.4.3",
    "systemjs": "^0.20.19",
    "zone.js": "^0.8.18"
  },
  "devDependencies": {
    "@types/node": "^8.0.34",
    "concurrently": "^3.5.0",
    "lite-server": "^2.3.0",
    "typescript": "^2.5.3"
  }
}

1 个答案:

答案 0 :(得分:0)

在你的vscode上试试这个

ctrl + `

它将打开底部的终端选项卡,现在运行

npm start or npm run start