2016-04-26 4 views
0

「と」EmberJs内のコンポーネントに属性を、私はこのように私のコンポーネントを呼び出すための構造を持っている、.hbsファイル内使用する際のパラメータを渡す方法/オペレータ

{{#myComponent as |section|}} 
    {{#if (eq section "section1")}} 

    this is the content for the first section <br> 

    {{else if (eq section "section2")}} 

    Some content for section two <br> 
    More content for second section <br> 

    {{/if}} 
{{/myComponent}} 

私のことができるようにしたいですこのようにいくつかのパラメータを渡します。

{{#myComponent as |section| param1="xyz" param2=true}} 

ビルド中に解析エラーが発生しています。

このシナリオでは、コンポーネントがアクセスするパラメータを引き続き渡すことはできますか?

ありがとうございます!

答えて

2

コンポーネントオブジェクト全体を使用しなければならず、 "as"キーワードが続くことがわかります。このように

{{#myComponent param1="xyz" param2=true as |section|}} 
関連する問題