Skip to content

Using multiple views and models in a widget #224

@ottoman

Description

@ottoman

Hi

Thanks for a great project!

Earlier versions of Aura allowed me to require the sandbox inside any view or model in a widget. So my widget could consist of several views and models all using the same sandbox.
define(['sandbox'], function(sandbox) { // use sandbox.mvc to extend models and views... });
Now, a widget is injected with the sandbox through the initialize method and I struggle to understand how to have a widget require other models/views. An example main.js based on a widget in aura-todos:
//main.js define(['./model'], function(Model) { return { type: 'Backbone', initialize: function() { this.model = new Model({sandbox: this.sandbox}); }, }; });

//model.js define(['backbone'], function(Backbone) { return Backbone.View.extend({ initialize: function() { this.sandbox.emit("something"); } }); });

Does this seem right? I feel like model.js should be extended from sandbox.mvc instead of requiring 'backbone'?

I feel like Im missing something. Any direction would be greatly appreciated. Thx again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions