One feature of my Backbone app involves associating models of type A with models of type B, which is done by dragging view A onto view B. In B's view class I listen for the drop event and from this I get the DOM element of view A, but no information about model A.
What's the best way to go about retrieving this information? My best guesses so far are
- have model A save a reference to itself in the app's namespace, removing this reference on drag end if the drop handler hasn't already done so
- fire an event on view A, passing a reference to model B along with the event, and then having model A call a method of model B...
- store model A as a $.data attribute of view A
but all these approaches seem convoluted/inelegant.