Concepts or coding lessons of Salesforce that you can implement easily

How to show difference with and without Lightning Locker Service for Lightning Components?

This is the summary of Lightning Locker Service in Salesforce. 

If you are not aware of Lightning Locker Service then I strongly recommend, Learn Lightning Locker Service here.

What Locker Service does is prohibit certain types of behaviors, such as trying to peek into the DOM of a component outside your own namespace.

For example, Locker Service disallows the following code example:

<lightning:button aura:id="button1" label="My Button" />

var element = component.find("button1").getElement();



Learn Learning Salesforce Lightning Application Development to accelerate your Career with Salesforce!!! 

You can’t use component.find("button1").getElement() to access the DOM element created by lightning:button

Locker Service doesn’t allow a Lightning component to access the DOM for lightning:button because the button is in the lightning namespace and Lightning Component is in the namespace.


Check out Disabling Locker Service for a Particular Component In Salesforce Expert Interview


Latest Salesforce Interview Questions and Answers:

loading...

2 comments:

  1. Hi nice article on Salesforce Lightning
    easy to read and implement 
    we have a similar post about Lighting called Locker Services and Lightning Components go through this you will and find more valuble information.

    ReplyDelete
  2. Really Appreciable!
    You have shared very valuable information that people should recognise. Thank you for sharing such an informative post with us.
    Salesforce Lightning Developer

    ReplyDelete