我正在用typscript学习Angular2,并在第一次更改后卡住了。这是我的问题。我的代码是:
import { Component } from '@angular/core';
@Component({
selector: 'pm-app',
template: `
<div><h1>{{pageTitle}}</h1>
<pm-prudcts></pm-products>
</div>
`
})
export class AppComponent {
pageTitle: string = 'Acme Product Manager';
}
我在使用Component Products和div标签时遇到错误:
Template parse errors:
Unexpected closing tag "pm-products" ("
<div><h1>{{pageTitle}}</h1>
<pm-prudcts>[ERROR ->]</pm-products>
</div>
"): AppComponent@2:24
Unexpected closing tag "div" ("
<div><h1>{{pageTitle}}</h1>
<pm-prudcts></pm-products>
[ERROR ->]</div>
"): AppComponent@3:8
答案 0 :(得分:3)
组件模板中存在拼写错误。将<pm-prudcts>
更改为<pm-products>
:
@Component({
selector: 'pm-app',
template: `
<div><h1>{{pageTitle}}</h1>
<pm-products></pm-products>
</div>
`
})