No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
JSON Models
Use a JSON model to read your initial component data in
Aura from a JSON resource.
To initialize your component from a more dynamic source, such as a record, use an Apex model instead.
Wiring Up the Model
You can explicitly declare a model in the aura:component tag by including a model system attribute with the format model="js://<namespace>.<componentName>". This enables reuse of a model from another component. For example, this component uses the model for auradocs.sampleComponent.
1swfobject.registerObject("clippy.codeblock-0", "9");<aura:component model="js://auradocs.sampleComponentIf you explicitly declare a model system attribute, it takes precedence over a model in the component bundle.
Sample JSON Model
Here is a sample JSON model.
1swfobject.registerObject("clippy.codeblock-1", "9");{
2 "bool" : true,
3 "num" : 5,
4 "str" : "My name is JSON",
5 "list" : []
6}Accessing the Model in Markup
Here is simple usage of a model in the markup of a component.
1swfobject.registerObject("clippy.codeblock-2", "9");<-- This component uses an auto-wired model
2 as this aura:component tag has no model system attribute -->
3<aura:component>
4 boolean: {!m.bool}
5 number: {!m.num}
6 string: {!m.str}
7 list length: {!m.list.length}
8</aura:component>