【问题标题】:My Angular2 website doesnt update using Angular2-cli我的 Angular2 网站没有使用 Angular 2-cli 更新
【发布时间】:2016-02-22 07:32:04
【问题描述】:

我正在 angular2 中构建小型应用程序,并尝试使用 webstorm 修改文件以查看它是否在我的浏览器中更新。

我执行了以下操作,到目前为止没有出现任何错误:

npm i -g angular-cli
ng new ponyracer
ng serve   (working on background)

在此文件中,我将“PonyRacer4566”更改为“dshbhs”,但浏览器中没有任何更新。

import {Component} from 'angular2/core';
@Component({
    selector: 'ponyracer-app',
    template: '<h1>PonyRacer4566</h1>'
})
export class PonyRacerApp {
}

【问题讨论】:

  • 你检查过开发者工具 -> 控制台是否有任何错误?

标签: terminal npm angular angular-cli


【解决方案1】:

我必须将这些行添加到我的 index.html 中才能使其正常工作;

<script src="vendor/es6-shim/es6-shim.js"></script>
  <script src="vendor/systemjs/dist/system-polyfills.js"></script>
  <script src="vendor/angular2/bundles/angular2-polyfills.js"></script>
  <script src="vendor/systemjs/dist/system.src.js"></script>
  <script src="vendor/rxjs/bundles/Rx.js"></script>

  <script src="vendor/angular2/bundles/angular2.dev.js"></script>
  <script src="vendor/angular2/bundles/http.dev.js"></script>
  <script src="vendor/angular2/bundles/router.dev.js"></script>

【讨论】:

  • 这是个坏主意,因为您加载了所有需要的库。
猜你喜欢
  • 2017-06-19
  • 1970-01-01
  • 2018-11-21
  • 1970-01-01
  • 1970-01-01
  • 2017-11-16
  • 1970-01-01
  • 1970-01-01
  • 2017-04-29
相关资源
最近更新 更多