Closed comerc closed 8 years ago
You can still use
Template.my.events
'click #id': ->
with ViewModel
But I want to use "this" of ViewModel inside event handler.
Template.my.events
'click #id': (e, t) ->
t.viewmodel.myValue()
VS
Template.my.viewmodel.events
'click #id': ->
@myValue()
There is no way you'll convince me that
Template.example.viewmodel
myValue: ''
Template.example.viewmodel.events
'click #id': ->
@myValue()
is somehow cleaner/easier/better than:
Template.example.viewmodel
myValue: ''
events:
'click #id': ->
@myValue()
OK. I may use:
Template.example.viewmodelEvents =
'click #id': ->
@myValue()
Template.example.viewmodel
myValue: ''
events: Template.example.viewmodelEvents
Vanilla Blaze:
VS ViewModel:
I want to suggest:
PS I know about binding events by function name, but ...