如果问题很简单请原谅我,我刚开始学习Angular。我正在尝试我的第一个应用程序,但它无法编译,因为它无法识别我的代码的一部分。请问有人能给我一些提示吗?
app.component.html文件:
<!--The whole content below can be removed with the new code.-->
<div style="text-align:center">
<h1>
Welcome to {{pageTitle}}!!
</h1>
... Starter Files ...
</div>
app.component.ts文件
import { Component } from '@angular/core';
@Component({
selector: 'pm-root',
template: <div><h1>{{pageTitle}}</h1></div> // **this line of code created error**
})
export class AppComponent {
pageTitle: string = 'Angular: Getting Started';
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Acme Product Management</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<pm-root></pm-root>
</body>
</html>