簡體   English   中英

角度:錯誤:模板解析錯誤:意外的結束標記

[英]Angular: Error: Template parse errors: Unexpected closing tag

我創建了一個新項目(使用Angular CLI-25/05/17),並將以下HTML代碼復制到了新組件中。 它看起來像基本的HTML代碼-可以作為自己的HTML頁面使用-但由於它位於Angular中,因此現在尚未編譯,這使我無所適從。 我研究了這個問題,每個人的情況似乎有所不同-一些是代碼中的錯別字,而另一些是標簽順序錯誤。 有任何想法嗎?

我收到此錯誤:

    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/FooterbarComponent.html@24: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/FooterbarComponent.html@25: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>

以下代碼已貶值,並導致HTML解析錯誤:

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

刪除這些內容並使用CSS處理列寬可解決此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM