0
更改爲使其更清晰。dom中重複的聚合物模板 - 如果
<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>
這裏是我的代碼與功能加入,其中規定的其爲真或假。
我具有一種類型,對於每一個上面列出的元件的,所以4個記錄的陣列。
結果表明從陣列中的記錄,但上述模板與DOM-如果節目中的每個元素的每個記錄。例如,具有數字類型的數據將顯示在上面顯示的每個部分中,而不是隱藏它們。
在對象的問題,我們有不同類型的調查問題,但是當我們通過調查對象,問題是重複在不同的格式通常是在不同的問題模板類型...這是。 ...問題1將在問題類型1(比如單選按鈕)和問題類型2(比如複選框)下顯示,儘管它在調查中返回的json中列爲類型1。
我是否使用dom-repeat和dom-如果正確?不知道我錯過了什麼。
你的修復是正確的,卜如果你看到我的更新上面的代碼,我缺少一個右括號,沒有出現任何調試器或棉短絨,或類似的東西....所以那種很爛,這些簡單的錯別字不顯示。 –
我明白了。我不知道有關棉絨或類似物的計劃。我目前沒有太多參與聚合物。 –