加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

typescript – VS angular2更改不会在浏览器上更新

发布时间:2020-12-17 07:31:52 所属栏目:安全 来源:网络整理
导读:我开始使用Angular2,当我第一次尝试运行我的项目时,它可以工作.问题是我正在关注教程,当我运行它时,任何浏览器都没有显示任何更改! 这是我的“app.component.ts”: import {Component} from 'angular2/core';@Component({ selector: 'my-app',template: 'h
我开始使用Angular2,当我第一次尝试运行我的项目时,它可以工作.问题是我正在关注教程,当我运行它时,任何浏览器都没有显示任何更改!

这是我的“app.component.ts”:

import {Component} from 'angular2/core';

@Component({
    selector: 'my-app',template: '<h1>Testing...</h1>'
})

export class AppComponent {
  title = 'Tour of Heroes';
}

这在任何浏览器上显示都可以,但是当我改为这个时:

import {Component} from 'angular2/core';

@Component({
    selector: 'my-app',template: '<h1>{{title}}</h1>'
})

export class AppComponent {
  title = 'Tour of Heroes';
}

它继续显示“测试……”.它假设显示“英雄之旅”.为什么?

我的所有其他文件与教程相同!

Ps.:我已经安装了“node and npm”!

[@PankajParkar提到需要编辑“System.config”]
这就是我在index.html上的内容,与Angular2上的教程相同

<script>
    System.config({
      packages: {
        app: {
          format: 'register',defaultExtension: 'js'
        }
      }
    });
    System.import('app/main').then(null,console.error.bind(console));
  </script>
这个问题令人沮丧,但这就是我的工作方式.

在浏览器中点击F12以显示开发人员工具.禁用缓存,如下所示

其次,我必须在web.config中的标记上方添加此部分以禁用缓存

<location path="app">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="DisableCache"/>
      </staticContent>
    </system.webServer>
</location>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读