Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for functions as templates #125

Closed
wants to merge 1 commit into from

Conversation

NatalieWolfe
Copy link
Contributor

This adds support for passing in a function as a template so you can use other a simple function of your own with no template engine, or a precompiled template (such as you get when using Jade).

@jharding
Copy link
Contributor

This is intriguing. Currently if you wanted to use something like Underscore for templating, you'd have to do something like:

$('.typeahead').typeahead({
  // ...
  template: '<%- value %>',
  engine = {
    compile: function(template) {
      var compiled = _.template(template);

      return {
        render: function(context) { return compiled(context); }
    }
  }
});

This is somewhat tedious and the solution in this pull request might make this a little easier to accomplish. I just need to think about this for a bit and make sure there's no drawbacks, but my gut reaction is that it should be fine. Assuming I don't think of any drawbacks, this will go out in v0.9.1. Thanks for the pull request!

@jharding
Copy link
Contributor

Updated your changes to work with v0.9.0, let's move any future discussion of this topic over to #137.

@jharding jharding closed this Mar 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants