Skip to content

Instantly share code, notes, and snippets.

@tamagokun
Created January 20, 2015 19:25
Show Gist options
  • Save tamagokun/6e1cc7c199700402e4a4 to your computer and use it in GitHub Desktop.
Save tamagokun/6e1cc7c199700402e4a4 to your computer and use it in GitHub Desktop.
module.exports = class ExampleView extends View
bindings:
'[name=sub_field]':
observe: 'field'
onSet: (val) ->
@setSubField 'sub_field', val
onGet: (val) ->
@getSubField 'sub_field', val
setSubField: (key, val) ->
field = @model.get 'field'
field[key] = val
field
getSubField: (key, val) ->
val[key] || ""
@tamagokun
Copy link
Author

I believe in this case @ or this is bound to the class object, not the instance so it won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment