Created
January 20, 2015 19:25
-
-
Save tamagokun/6e1cc7c199700402e4a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] || "" |
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
Any idea why this:
'[name=sub]' : @Bindm 'sub'
Or this:
'[name=sub]' : () -> @Bindm 'sub'
Don't work?
bindM: (k) ->
{observe: 'field'
onSet: (v) -> @setSubField k v
}