2013-04-23 85 views
0

我試圖做到這一點的骨幹:你可以把JST模板放在_.template函數中嗎?

@modal_template = _.template(JST["templates/collaborators/share_auditions_modal"]) 

應該存儲模板JST文件到@modal_template變量。雖然它不起作用。我不能將模板放在視圖中的「模板:」中,因爲這只是該視圖內的事件。

回答

0

我對JST方法不是很熟悉,但我認爲你的語法是向後的。也許你想坐編譯下劃線的模板,並將其放置到JST對象供以後使用:

window.JST['person/contact'] = _.template(
    "<div class='contact'><%= name %> ..." 
); 

更多信息請參見this questionthis article這是上面的代碼片段的來源。