Share Your Experience With Others

Lightning Component Interview Notes Part 2

Lightning Application:

  • Standalone lightning app has custom URL can be hosted and run using the URL.
  • Can have components.
  • Standalone apps .app extension.
  • Checkbox lightning out dependency app used to make available the LEX App for VF Pages.
  • <aura: application extends=”force:slds”> used to apply LEX UI.
  • It’s not possible to use lightning out app in LEX experience.

Component Attributes:

  • Attributes makes your component more dynamic and can store value of different type.
  • Attribute name must start with letter or underscore.
  • Attribute name must have 2 or more characters.
  • It’s a best practice to declare all the attribute names at the top of the component as that makes your code more readable.
  • Three access specifiers for attributes:
    • Global: can be used in any namespace
    • Public: within the same namespace only
    • Private: only within the container app, interface, component or event
  • <aura: attribute name=”buttonLabel” type=”String” default=”Search”>
  • These data types are available:
    • Boolean
    • String
    • Integer
    • Double
    • Long
    • Decimal
    • List
    • Set
    • Map
    • Object
    • Date
    • DateTime
  • Getting and Setting Attribute value:
    • get attribute value: var value=component.get(“v.attritbuteName”);
    • set attribute value: component.set(“v.attributeName”,value);
    • calling controller function: onclick or some event: {!c.functionName}
    • Finding component by id: component.find(“id”).set(“new_value”); or get(“v.value”);

Expressions:

  • Allows you to access attribute values
  • Expression doesn’t support function calls
  • Can be used for dynamic output
  • {!expression}: called as bound expression. Fetch new value of attribute automatically as soon as attribute value is modified by component.
  • {#expression}: called as unbound expression. It doesn’t refresh value automatically.
  • Use {!v.attribute} or {#v.attribute}

To clear the cache:

Go to Setup->Type Component->Click Lightning Component->Enable Checkbox “Enable Debug Mode”

Leave a comment