Topics for this chapter:
– Aura Attributes
– Bound and Unbound Expression
All attributes have a name and a type. Attributes may be marked as required by specifying required=”true”, and may also specify a default value.
An attribute name must follow these naming rules:
– Must begin with a letter or an underscore
– Must contain only alphanumeric or underscore characters
There are many different types which can be used within aura components. You can create:
and all custom object, apex class, and standard object types.
You can declare an attribute like below:
Expression allows you to access attribute values or make calculations within component markup. Expression can be used for dynamic output but does not support function calls.
You can access attribute values in two ways:
– Bound Expression – Uses 2-way data binding and fetches the new value of attribute automatically as soon as attribute value is modified by component. You can use the bound expression to access attribute value like below:
– Unbound Expression – Uses one-time data binding (do not confuse with one-way data binding), this means the expression will only hold the value at the time of initialization, and will never read new attribute data. You can use the unbound expression to access attribute value like below:
Lightning Component Development Day3 - App, Attributes, Looping, Conditional Markup, Handling Events
Attributes and Expression