2015-10-10 49 views
0

需要在Jade模板註釋中打印參數的值。該值正確傳入;如預期了以下工作:在Jade模板中打印註釋中的表達式值

if type !== "surveyFree" 
    ul.pollOptions 
     for answer, idx in answers 
      li 
       +printAnswer(answer, idx) 
else 
    textarea(cols="50", rows="4", placeholder="Type in your answer") 

然而,所有試圖打印出的註釋裏面的type變量的值都失敗了。我嘗試了以下形式:

// "type = " + type 
// #{"type = " + type} 
// span= #{"type = " + type} 
// span= type = #{type} 

和許多其他,但沒有任何作品(所有東西都打印完全按照我輸入)。我想輸出:

<!-- type = challenge --> 

<!-- type = survey --> 

所有幫助感激!

回答

2

也許這種方式將是對你有好處:

!='<!-- COMMENT VARAIBLE: ' + variable + '-->' 
+0

是啊,這沒有工作。謝謝! – markvgti