If you require a widget in a XML view like this:
It generates code like this:
Let’s take a look at the code for createWidget in alloy.js:
As you can see, the second argument specifies the controller to require from the widget. You might not have known this, but the docs do mention that widget can contain multiple view-controllers, just like your app does.
Unfortunately, to use this feature you need to create the widget in your controller using code similar to the second fragment above. It’s currently not possible to do this in the view.
This is a missed opportunity to use a singe widget to expose a collection of reusable UI elements:
Or create a widget that can be used in multiple contexts:
So my feature request / improvement would be to support the name attribute for <Widget> elements, whose value would be used as the second argument for createWidget. I’ve made the necessary changes to Alloy.Require.js and did a pull request for this: