I'm rewriting a category tree view into a RequireJS and Backbone app.
The structure is simple: each category contains a collection of child categories.
However, the circular dependency problem becomes quickly apparent. The category model requires the category collection and the category collection requires the category model.
There is quick blurb about circular dependency in the RequireJS docs:
http://requirejs.org/docs/api.html#circular
However, it seems that I'm missing something because I'm still getting undefineds and/or errors. I think just seeing 'b' and not 'a' in the examples is keeping me from understanding.
Is anyone able to provide a simple example that might clarify? That, or a better way of structuring this that wouldn't require a circular dependency.