2017-05-30 55 views
0

Iam新增聚合物。我創建了一個組件應用程序標籤。內嵌HTML聚合物導入外部模板

<link rel="import" href="https://polygit.org/polymer+^1.9.1/webcomponentsjs+^0.7.0/components/polymer/polymer.html"> 
<dom-module id="app-tag"> 
    <template> 
     <style></style> 
     <h1 class="head-mine">This is the name Tag</h1> 
    </template> 
</dom-module> 
<script src="app_tag.js"></script> 

它工作正常。但是,如果我的模板非常大,我想寫seoerate html文件使用它。我該如何解決這個問題。?

回答

0

那麼這是非常unopolymer你正在嘗試做什麼。更有可能與聚合物發揮更好的將是創建第二個組件,然後將被用作兒童組件。 如果您在其他地方使用模板,您可以嘗試使用Polymer.Templatizer,然後創建另一個組件,其中包含一個可以被Templatizer引用的ID的模板。

//second component 
<dom-module id="my-second"> 
    <template> 
     <template id="myAwseomeTemplate"><div>test</div></template> 
    </template> 
</dom-module> 
+0

test
我想這在另一個文件和HTML當然 –

+0

喜Vijayyes第二部分是在另一個文件中使用。聚合物讓您爲每個組件創建一個新文件。 –