Polymer 聚合物中数据项的条件显示

Polymer 聚合物中数据项的条件显示,polymer,Polymer,我正在显示从JSON文件中提取的数据,其中一个JSON属性可能有值,也可能没有值。我只想在JSON文件中的值存在时显示文本。我尝试了以下操作,但没有显示任何内容 <template is="dom-repeat" items="[[session]]" as="subSession"> .... Display other values from the JSON file <template is="dom-if" if="{{subSession.track.presen

我正在显示从JSON文件中提取的数据,其中一个JSON属性可能有值,也可能没有值。我只想在JSON文件中的值存在时显示文本。我尝试了以下操作,但没有显示任何内容

<template is="dom-repeat" items="[[session]]" as="subSession">
.... Display other values from the JSON file
 <template is="dom-if" if="{{subSession.track.presentation}}">
   <div class="session-meta layout horizontal">
     <iron-icon class="session-meta-icon" icon="class"></iron-icon>
     <span>Presentation Available</span>
   </div>
 </template>

.... 显示JSON文件中的其他值
可用演示文稿

以下是对我有效的方法:

仅当接受项目数据的projectID时才显示项目数据

 <template is="dom-repeat" items="{{projects_list}}" as="project">
      <template is="dom-if" if="{{project_check(project.projectID)}}">
       ...display project values here...
      </template>
 </template>
 <script>
 project_check: function(projectID) {
        console.log('project_check:');
        console.log(projectID);
        //check if  projectID is accepted here.
        //return true or false to render or not the template.
    },
 </script>

…在此处显示项目值。。。
项目检查:功能(projectID){
log('project_check:');
console.log(projectID);
//检查此处是否接受projectID。
//返回true或false以呈现或不呈现模板。
},

之前没有使用过dom if,我不确定是否正确使用了它。问题中的上述代码是此条件的正确用法。我无意中使用了错误的变量,该变量应该是[[subSession.presentation]]。

谢谢,您认为项目检查脚本有必要吗?我能够做到这一点,只使用dom if语句。