0
Angular2新手在這裏。Angular2錯誤TS1146:聲明預計
我使用的是從Angular.io種子文件,但是當我運行 'NPM啓動' 我得到一個TSC編譯器錯誤 -
TSC -p的src/
的src /應用/ app.module .ts(11,3):錯誤TS1146:預期聲明。
有人可以告訴我什麼,我錯過了請。我只有一個組件'AppComponent'。
app.module.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<h1>Hello</h1>
`,
})
export class AppComponent {
}
和index.html
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>
你可以刪除'模板逗號: '
你好
','? – echonax