javascript - How to jQuery bindings with a Backbone View -
i have backbone view, inside view there's input uses twitters typeahead plugin. code works, i'm doing typeahead initialisation inside html code , not in backbone code.
typeahead.init('#findprocedure', 'search/procedures', 'procedure', 'name', function(suggestion){ var source = $("#procedure-row-template").html(); var template = handlebars.compile(source); var context = { name: suggestion.name, created_at: suggestion.created_at, frequency: suggestion.frequency.frequency, urgency: suggestion.urgency.urgency, id: suggestion.id }; var html = template(context); addrow.init("#procedure-table", html); });
the code above works inside script tag.
but when try taking backbone doesn't work.
what i'm trying in bb code is:
initialize: function(ob) { var url = ob.route; this.render(url); this.inittypeahead(); this.delegateevents(); },
and inside init function there's code works, not in bb. wrong ? correcto approach ?
thanks.
Comments
Post a Comment