You haven't specified the context
argument when calling each
:
@collection.each (post) ->
console.log @template( post.attributes )
so @
is probably window
when you say @tempate(post.attributes)
. Specify the desired context
when calling each
:
@collection.each (post) ->
console.log @template(post.attributes)
, @
or use a fat-arrow (=>
) with the callback:
@collection.each (post) =>
console.log @template(post.attributes)