アンダースコアテンプレートの解析中にエラーが発生しました。次のようなエラーが発生し続けます。
Uncaught SyntaxError: Unexpected token else
以下のテンプレートは次のとおりです。Jadeの使用
script#viewLinksTemplate(type="text/template")
table.table.table-condensed.table-striped
caption Available links
thead
tr
td link id
td Name
td View
td Edit
td Remove
tbody
{[ _.each(routes, function(route) { ]}
tr
td {{ route._id }}
{[ if (typeof route.name !== 'undefined') { ]}
td {{ route.name }}
{[ } ]}
{[ else { ]}
td {{ route.stations.start.name }} - {{ route.stations.end.name }}
{[ }; ]}
td
a.btn.btn-primary(href="/route") View Route
td
a.btn.btn-warning Edit Route
td
a.btn.btn-danger Delete Route
{[ }); ]}
問題はif/elseステートメントにあるようです。完全に削除すると、テンプレートに残っている部分がレンダリングされます。
だから、私は構文に何かが欠けていますか?私の他のすべてのテンプレートにはjavascriptがあり、if / elseを使用したものを除いて、正しくレンダリングされます。
ありがとう