- What is Lightning Data Service?
Lightning data service helps you to perform CRUD(Create/Read/Update/Delete) operations on a record without Apex code. It will honor Field level security and sharing rules for us without any additional processing.
- How to create components using Lightning Data Service?
We could use lightning:recordForm(Display/Create/Edit record) or lightning:recordEditForm (Create or edit Records with lightning:inputField) or lightning:recordViewForm(Display records with lightning:outputField) to create components. If we need additional customization then we can use force:recordData
13. What is the major limitation with Lightning Data Service?
We could use Lightning Data Service for only Single Record. It does not support multiple records.
- What is Component Event propagation?
Component uses capture and Bubble phases for event propagation. These phases are similar to DOM handling patterns and interested components can interact with the event.
The event is captured and trickles down from the application root to the source component. The event can be handled by a component in the containment hierarchy that receives the captured event. Event handlers are invoked in order from the application root down to the source component that fired the event. Any registered handler in this phase can stop the event from propagating, at which point no more handlers are called in this phase or the bubble phase.
The component that fired the event can handle it. The event then bubbles up from the source component to the application root. The event can be handled by a component in the containment hierarchy that receives the bubbled event. Event handlers are invoked in order from the source component that fired the event up to the application root. Any registered handler in this phase can stop the event from propagating, at which point no more handlers are called in this phase.
- What is the sequence of Event propagation?
Event Fired –A component event is fired.
Capture Phase–The framework executes the captured phase from the application root to Source component until all components are traversed. Any handling event can stop the event propagation by calling stopPropagation() on the event.
Bubble phase — The framework executes the bubble phase from the Source component to the application root until all components are traversed or stopPropagation() is called.
- How to create custom component Event in aura framework?
Use tag in .evt resource to create a custom component Event. Events can contain attributes that can be set before the event is fired and read when the event is handled.
- How to handle component events in aura framework?
A component event can be handled by the component that fired the event(Source component) or by a component in the component hierarchy/Parent components.
Use <aura:event> tag in the markup of handler component
The name attribute in must match the name attribute in the tag in the component that fires the event.
Note: Component Event handlers are associated with bubble phase by default. We can use Phase attribute to change the handler to Capture phase.
- What are Application events in aura framework?
Application events follow traditional publish-subscribe model. Application event is fired from an instance of the component and all components that provide a handler for the event are notified.