2017-09-06 9 views
0

私はheder、footerのようないくつかの他の部分を私のメインHTMLにインポートしたいので、私はaureliaでこれを行うことができますか?は、Aurelia.jsのng-includeに関連しています

私はこの怒鳴るを試してみましたが、

<template> 
<import from='header.html'></import> 
<import from='footer.html'></import> 
</template> 
+1

http://aurelia.io/hub.html#/doc/article/aurelia/templating/latest/templating-dynamic-ui-composition/3 – Claies

答えて

3

構文は動作しませんでしたが、次のとおりです。あなたのコンポーネントがビューとビューモデルのペアで構成されている場合

<template> 
    <require from='./header'></require> <!-- this "requires" the component --> 
    <require from='./footer'></require> 

    <header></header> <!-- this "uses" the component --> 
    <!-- content --> 
    <footer></footer> 
</template> 

、あなただけ<require from="./header"></require>を使用する必要があります。ビューだけで構成されている場合は、最後に '.html'を付ける必要があります。<require from="./header.html"></require>

関連する問題