角度2应用程序被另一个网页替换

时间:2017-02-07 15:43:00

标签: javascript angularjs node.js

我一直致力于从本教程中学习角度2项目http://courses.angularclass.com/p/angular-2-fundamentals

我在localhost:3000上使用npm run api运行我的api 整个应用程序被另一个网页取代

enter image description here

我的package.json是:

{


    "name": "retain",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "webpack --config webpack.spec.ts --progress --color && karma start",
        "start": "webpack-dev-server --inline --colors --progress --display-error-details --display-cached --port 3000  --content-base src",
        "api": "angularclass-server --api retain --port 3000"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "@angular/common": "^2.0.0",
        "@angular/compiler": "^2.0.0",
        "@angular/core": "^2.0.0",
        "@angular/forms": "^2.0.0",
        "@angular/http": "^2.0.0",
        "@angular/platform-browser": "^2.0.0",
        "@angular/platform-browser-dynamic": "^2.0.0",
        "@angular/router": "^3.0.0",
        "@angularclass/api": "^1.2.0",
        "core-js": "^2.4.1",
        "lodash": "^4.16.1",
        "rxjs": "5.0.0-rc.4",
        "zone.js": "^0.7.2"
      },
      "devDependencies": {
        "@types/core-js": "^0.9.33",
        "@types/lodash": "^4.14.35",
        "@types/node": "^6.0.39",
        "awesome-typescript-loader": "3.0.0-beta.10",
        "css-loader": "^0.26.1",
        "jasmine-core": "^2.4.1",
        "karma": "^1.1.1",
        "karma-chrome-launcher": "^1.0.1",
        "karma-jasmine": "^1.0.2",
        "karma-mocha-reporter": "^2.0.4",
        "raw-loader": "^0.5.1",
        "to-string-loader": "^1.1.4",
        "ts-helpers": "^1.1.1",
        "typescript": "^2.1.4",
        "webpack": "^1.14.0",
        "webpack-dev-server": "^1.16.2"
      }

}

请告诉我是否需要添加任何其他内容来识别此错误。 提前谢谢。

1 个答案:

答案 0 :(得分:0)

根据包JSON

有2个脚本。  1. npm run start:运行angular 2应用程序  2. npm run api:它创建了一个单独的羽毛项目,用于Rest API,你可以在https://www.npmjs.com/package/feathers上找到更多abt模块

所以对于角度2,如果你需要一些休息API,你可以在羽毛项目&然后在angular 2 Application

中使用它