View get/set and defaults for options
mateusmaso opened this issue · 1 comments
mateusmaso commented
Same behavior of model attributes
and collection meta
for view options
.
mateusmaso commented
The last commit introduces this new feature. By default, any changes via get/set will update bindings and the options are also passed in context:
class App.YoutubeView extends Hipbone.View
...
defaults:
playing: false
play: ->
@set(playing: true)
stop: ->
@set(playing: false)
alertState: ->
alert(@get("playing"))
your template:
{{#if playing bind=true keypath="playing"}}
<h1>Playing video</h1>
{{else}}
<h1>Video stopped</h1>
{{/if}}
...