BAE
BAE

Reputation: 8936

Backbone: how to manipulate elements outside the element associated with View

My html structure is:

<div id="header">
</div>

<div id="screen">
</div>

My Backbone View is associated with screen. How to hide/show element in header?

Upvotes: 0

Views: 62

Answers (2)

Ofer Haber
Ofer Haber

Reputation: 628

According to the backbone structure & logic - your headerview or screenview should throw an event, in which header view should listen to. If that event happens - then headerview should hide itself.

Upvotes: 0

Amit
Amit

Reputation: 46341

The direct answer is:

There's nothing special backbone will do for you here. Do it like you would do had backbone not existed at all.

The correct answer is:

If you need to manipulate UI elements outside of your view model, your view model is wrong - fix it.

Upvotes: 3

Related Questions