2017-05-31 193 views
0

我創建了一個新項目(使用Angular CLI - 25/05/17)並將下面的HTML代碼複製到一個新組件中。它看起來像基本的HTML代碼 - 作爲它自己的HTML頁面 - 但現在不在編譯它在Angular中,這讓我撓了腦袋。我研究過這個問題,每個人看起來都不一樣 - 有些是代碼中的拼寫錯誤,有些是錯誤地排序的標籤。有任何想法嗎?Angular:Error:Template parse errors:意外的結束標記

我收到此錯誤:

Error: Template parse errors: 
Unexpected closing tag "table". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (" 
     </th> 
    </tr> 
    [ERROR ->]</table> 
</div> 

"): ng:///AppModule/[email protected]:2 
Unexpected closing tag "div". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (" 
    </tr> 
    </table> 
[ERROR ->]</div> 

<!-- 
"): ng:///AppModule/[email protected]:0 

而且我的代碼是:

<div id="footerRoot"> 
    <table class="footerfont" width="100%"> 
    <col width="75%"> 
    <col width="25%"> 
    <tr> 
     <th> 
     <ol class="zeroMargin breadcrumb"> 
      <li><a href="" target="_blank" class="link-external">State</a></li> 
      <li><a href="">Accessibility</a></li> 
      <li><a href="" target="_blank" class="link-external">Copyright &amp; Disclaimer</a></li> 
      <li><a href="" target="_blank" class="link-external">Privacy</a></li> 
      <li><a href="">Sitemap</a></li> 
      <li><a href="">Feedback</a></li> 
     </ol> 
     </th> 
     <th class="footerfont"> 
     <div> 
      © BLAH 
     </div> 
     <div> 
      Last Updated: <time datetime="18 April 2017">18 April 2017</time> 
     </div> 
     </th> 
    </tr> 
    </table> 
</div> 

回答

0

下面的代碼貶值,並導致HTML解析錯誤:

<col width="75%"> 
<col width="25%"> 

刪除那些和使用CSS來處理列寬解決了這個問題。