【发布时间】:2016-09-13 14:49:13
【问题描述】:
第一次使用 angular2 ,遵循 5 minute Quickstart guide 的 angular 2 指令。
一切正常,运行时没有错误npm start
但是当我打开时
本地主机:3000
它显示 Loading... 文本,这是不期望的。根据这个例子 index.html 的内容应该反映在这个上。
在控制台有错误:
例外:TypeError:无法将属性“endSourceSpan”设置为 null
main.ts
import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
bootstrap(AppComponent);
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: 'My first Angular 2 App</h1>'
})
export class AppComponent {}
index.html
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
请帮我解决问题。
【问题讨论】:
-
你能提供你的主要组件的代码吗?谢谢!
-
好的,谢谢!
app.component.ts文件呢? -
也许这是相关的:stackoverflow.com/a/37070952/1961059(也错误地关闭了标签/错别字)
-
我已经在问题中添加了代码。