[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
TheProposed 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;
Comments
- Tony Lukasavage 2012-11-28
In the process of creating
instances, a lot of additional validation and error reporting was added to the Alloy.Collection parser. In addition, the models/todo_binding test app was updated and had a bug or two in it fixed.