2017-03-06 94 views
0

我學習了Angular2與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'; 
} 

並即時得到錯誤與組件產品和div標籤:

Template parse errors: 
Unexpected closing tag "pm-products" (" 
     <div><h1>{{pageTitle}}</h1> 
      <pm-prudcts>[ERROR ->]</pm-products> 
     </div> 
    "): [email protected]:24 
Unexpected closing tag "div" (" 
     <div><h1>{{pageTitle}}</h1> 
      <pm-prudcts></pm-products> 
     [ERROR ->]</div> 
    "): [email protected]:8 
+4

你拼寫錯誤'PM-products'在你的標籤之一,請確保開始和結束標記具有相同的名稱 – OmarIlias

回答

3

。在你的組件模板錯字。更改<pm-prudcts><pm-products>

@Component({ 
    selector: 'pm-app', 
    template: ` 
     <div><h1>{{pageTitle}}</h1> 
      <pm-products></pm-products> 
     </div> 
    ` 
})