2016-06-14 7 views
0

もっと明確になるように変更されました。ここでポリマーテンプレートがdom-ifで繰り返す

<template is="dom-repeat" items="{{survey.Questions}}"> 
    <template is="dom-if" restamp if="{{isFormat(item.Type, 'Single-Select')}}"> 
    <question-singleselect question="{{item}}" auth-Data="{{authData}}"></question-singleselect> 
    </template> 
    <template is="dom-if" restamp if="{{isFormat(item.Type,'Open-Ended'}}"> 
    <question-openended question="{{item}}" auth-Data="{{authData}}"></question-openended> 
    </template> 
    <template is="dom-if" restamp if="{{isFormat(item.Type,'Text Block'}}"> 
    <question-textblock question="{{item}}" auth-Data="{{authData}}"></question-textblock> 
    </template> 
    <template is="dom-if" if="{{[[}}isFormat(item.Type,'Numerical'}}"> 
    D: {{item.Type}} 
    <question-numerical question="{{item}}" auth-Data="{{authData}}"></question-numerical> 
    </template> 
</template> 

あなたの機能を持つ私のコードは、trueまたはfalseにのにそれを設定され、追加されます。

私は1つのタイプを持っています。これは、上記の要素ごとに4つのレコードの配列です。

結果には配列のレコードが表示されますが、上記のdom-ifのテンプレートには各要素の各レコードが表示されます。たとえば、数値の型を持つデータは、上の各セクションに表示され、非表示にはなりません。

調査対象にはさまざまなタイプの質問がありますが、調査対象を渡すと、異なる質問テンプレートタイプにある異なる形式で質問が繰り返されます。質問1は質問型1(ラジオボタン)と質問型2(チェックボックス)の両方で表示されますが、調査で返されるjsonにtype1としてリストされています。

dom-repeatとdom-ifを正しく使用していますか?私が不足しているものを驚かせてください。

答えて

1

ポリマーはバインディングの式をサポートしていません。また、How do I write condition in polymer1.0 with "dom-if"?

dom-repeatは、私はコードを見ずに言うことができると思います。

+0

上記の更新されたコードが表示された場合、右の括弧が欠けています。デバッガやリンターなどには表示されません。シンプルなタイプは表示されません。 –

+0

私は参照してください。私はリンターやそれに類するものについての計画は知らない。私は現在Polymerにあまり関与していません。 –

関連する問題