What is the @ $ el trunk?

in many textbooks, I see people doing this:

view = new Raffler.Views.EntriesIndex(collection: @collection)
$('body').html(view.render().el)

And then in the Record view, he does:

render: ->
  @$el.html(@template())

I thought it @$elwas said with: hey visualize this template in the parent element (in this case, the body) ... but it does not work and does not show anything ... If I use $('body').html(@template())instead everything works fine. Now ... why do people use @$elin textbooks (I saw this in 2-3 textbooks)?

+4
source share
1 answer

In Backbone, views typically store a link to their element wrapped in jQuery. This is usually called this.$el.

$ , DOM, flegded jQuery. , $el.find() $el.children().

CoffeeScript @ this. , @$el this.$el.

+4

All Articles