This code is passing in a function and is not carrying over the state of my EmployeesController object. What can i do to bind my EmployessController object to the focus event?
class @EmployeesController
constructor: (@dateInput) ->
@dateInput.focus(@searchInputGainedFocus)
searchInputGainedFocus: ->
console.debug @dateInput
In other words, console.debug prints undefined when i give dateInput focus.
Use the “fat arrow” (
=>) to bindsearchInputGainedFocusto the object:So define
searchInputGainedFocuslike this: