我如何try catch
用 jQuery tmpl 编写代码?我尝试了两种方法并得到了这些错误:
1. Uncaught SyntaxError: Unexpected token try
{{each items}}
<div>
<span>
${
try{
services[0].id
}catch(e){
throw new Error(e)
}
}
</span>
</div>
{{/each}}
2. Uncaught Unknown 模板标签:try
{{each items }}
<div>
{{try {}}
<span>${services[0].id}</span>
{{} catch(e){
throw new Error(e)
}
}}
</div>
{{/each }}