Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在模板中使用If条件_Jquery_Knockout.js_Jquery Templates - Fatal编程技术网

Jquery 在模板中使用If条件

Jquery 在模板中使用If条件,jquery,knockout.js,jquery-templates,Jquery,Knockout.js,Jquery Templates,如何在jQuery模板中使用IF语句 这是我的模板: {{如果$item.current_cmt_id==id} {{/if} 其中id本质上是${id},并且由数据绑定(通过KnockoutJS)传递。如果没有IF语句,它可以正常输出,如下所示:${$item.current\u cmt\u id} 以下是数据绑定(由KnockoutJS提供支持): 假设id是可观察的,则需要将其作为函数调用,而不是将其视为属性。请尝试以下操作: {{if $item.current_cmt_id

如何在jQuery模板中使用
IF
语句

这是我的模板:


{{如果$item.current_cmt_id==id}
  • {{/if}
    其中id本质上是
    ${id}
    ,并且由数据绑定(通过KnockoutJS)传递。如果没有IF语句,它可以正常输出,如下所示:
    ${$item.current\u cmt\u id}

    以下是数据绑定(由KnockoutJS提供支持):