[ALOY-379] Create <Collection> in markup (instance)
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-11-28T22:02:04.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 0.3.3, 2012 Sprint 24 |
Components | Runtime, XML |
Labels | notable |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-11-13T17:19:39.000+0000 |
Updated | 2018-03-07T22:25:47.000+0000 |
Description
The tag currently only creates/references a global singleton version of the collection. We need to implement such that instances bound to the current controller can be created as well.
must always be the child of
would be made available in Alloy.Collections, an instance collection will be attached to the current controller just as a UI component. So the above instance collection would be accessible in controller code like this:
Proposed Syntax
*NOTE:*Singleton
<!-- "src" is the Alloy Model on which the collection is based -->
<Alloy>
<!-- Accessible globally as Alloy.Collections.myModel -->
<Collection src="myModel"/>
</Alloy>
Instance
<!-- * "src" is the Alloy Model on which the collection is based
* "id" works just like it does on UI components, creating a reference
* "instance" tells Alloy to create an instance instead of a singleton -->
<Alloy>
<!-- Accessible as $.myModel in corresponding controller -->
<Collection id="someId" src="myModel" instance="true"/>
</Alloy>
While a singleton
var collectionInstance = $.someId;
In the process of creating