Skip to content

Instantly share code, notes, and snippets.

@psykidellic
Created September 5, 2012 07:36
Show Gist options
  • Select an option

  • Save psykidellic/3632696 to your computer and use it in GitHub Desktop.

Select an option

Save psykidellic/3632696 to your computer and use it in GitHub Desktop.
class @Santoor extends Backbone.View
constructor: (@templateId) ->
render: ->
console.log @templateId
template = _.template($(@templateId).html())
// if I remove the constructor part and use
// template = _.template($("#santoor-player").html())
// it works
console.log(template)
$(@el).html(template)
console.log(@el)
@
>>>
<script id="santoor-player" type="text/template" charset="utf-8">
<audio controls>
<source src="Bolero.mp3">
Your fallback goes here.
</audio>
</script>
<script type="text/javascript" charset="utf-8">
$(function() {
var x = new Santoor("#santoor-player");
$("#main").append(x.render().$el);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment