我想通過燒瓶應用程序定義typeahead.js的模板。Twitter Typeahead.js與燒瓶Jinja2模板
我正在尋找的解決方案是覆蓋默認(jinja2)模板,或使用默認值來定義新模板。
更新:
這是我到目前爲止。除「value」以外的任何其他值都不起作用。
$('#search').typeahead({
name: 'Search',
local: {
value: 'String1',
tokens: ['1','one'],
name: 'StringTest'
},
template: '<p>Template {{value}}{{name}}</p>', // Only shows "Template String1"
engine: Hogan
});
這裏是我的模板是什麼樣子
<script src='http://twitter.github.com/typeahead.js/releases/latest/typeahead.js'</script>
<script src="http://twitter.github.com/hogan.js/builds/2.0.0/hogan-2.0.0.js"></script>
<script src="static/js/search.js"></script> // Hard coded to see if it works..
我更新。希望我的問題更清楚。 – sangm