Pli*_*nio 8 npm typescript angular
我开始使用Angular2,当我第一次尝试运行我的项目时,它可以工作.问题是我正在关注教程,当我运行它时,任何浏览器都没有显示任何变化!
这是我的"app.component.ts":
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: '<h1>Testing...</h1>'
})
export class AppComponent {
title = 'Tour of Heroes';
}
Run Code Online (Sandbox Code Playgroud)
这在任何浏览器上显示都可以,但是当我改为这个时:
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: '<h1>{{title}}</h1>'
})
export class AppComponent {
title = 'Tour of Heroes';
}
Run Code Online (Sandbox Code Playgroud)
它继续显示"测试......".它假设显示"英雄之旅".为什么?
我的所有其他文件与教程相同!
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>
Run Code Online (Sandbox Code Playgroud)
这个问题非常令人沮丧,但这就是我的工作方式.
在浏览器中点击F12以显示开发人员工具.禁用缓存,如下所示
其次,我必须在web.config中的标记上方添加此部分以禁用缓存
<location path="app">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache"/>
</staticContent>
</system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4883 次 |
最近记录: |