I am working with twitter's typeahead.js and I was wondering if it was possible to modify hogan.js
to use something other than {{}}
?
I am looking at the minified code now and I have no idea what to change for something so simple. Doing a find and replace breaks it.
I am asking this mainly because I'm using Angular JS but twitter's typeahead requires a templating engine, causing hogan and angular's {{}}
to clash. An even better solution would be simply modifying Angular JS (I know it's not a templating engine) and ditching Hogan to fit the following criteria:
Any template engine will work with typeahead.js as long as it adheres to the following API:
// engine has a compile function that returns a compiled template
var compiledTemplate = ENGINE.compile(template);
// compiled template has a render function that returns the rendered template
// render function expects the context to be first argument passed to it
var html = compiledTemplate.render(context);
<% %>
. All I did was a find and replace for"{{"
and"}}"
. No more conflicts with angular! Let me know if you can use angular as the template engine... not very fond of including Hogan just for a simple typeahead box. – Aglowtypeahead.js
file in my scripts, and call thetypeahead()
function on the input field I want. Nothing fancy, really easy to set up and I love it. Take a look at the source code for their examples, it help me figure out some of the stuff: twitter.github.io/typeahead.js/examples – Aglow{{ }}
directives. Yeah, nasty. – Aglow