我开始使用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>