Reputation: 5809
I have a backbone.sticket binding attached to a model associated with a mainView
view:
bindings: -> {
".some-class": "someAttribute",
}
and the following template
<div class="some-class"></div>
The attribute populates correctly, but when I attempt to edit someAttribute
in the browser console:
router.mainView.model.attributes.someAttribute = "TEST"
nothing changes in the binding, even though typing
router.mainView.model.attributes.someAttribute
into the browser console returns "TEST"
as expected.
Should I expect the content of the div to be changing in the browser as well?
Upvotes: 0
Views: 468
Reputation: 434685
Sticket is presumably event based and Backbone events don't work that. If you edit a model's attributes
by hand, nothing in Backbone will know what happened so no events will be triggered. If you want events to be triggered, you need to use set
:
router.mainView.model.set('someAttribute', 'TEST')
// or
router.mainView.model.set({ someAttribute: 'TEST' })
Either of those should generate "change"
events and that's probably what Sticket uses to hook itself up.
Upvotes: 1