Titanium JIRA Archive
Alloy (ALOY)

[ALOY-391] Create <Model> in markup (instance)

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusResolved
ResolutionFixed
Resolution Date2012-11-29T23:21:21.000+0000
Affected Version/sn/a
Fix Version/sAlloy 0.3.3, 2012 Sprint 24
ComponentsXML
Labelsn/a
ReporterTony Lukasavage
AssigneeUnknown
Created2012-11-14T20:11:46.000+0000
Updated2018-03-07T22:25:57.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.

Proposed Syntax

Singleton

<!-- "src" is the Alloy Model on which the model is based -->
<Model src="myModel"/>

Instance

<!-- "src" is the Alloy Model on which the model is based -->
<!-- adding an "id" will implicitly make this an instance -->
<!-- "instance" can explicitly make the collection an instance -->
<Model id="someId" src="myModel" instance="true"/>
While a singleton would be made available in Alloy.Models, an instance model will be attached to the current controller just as a UI component. So the above instance model would be accessible in controller code like this:
var modelInstance = $.someId;

Comments

No comments

JSON Source