Contents
What does a controller do in Lightning component?
For our purposes, for Lightning Components, a controller is a resource in a component bundle that holds the action handlers for that component. And action handlers are just JavaScript functions with a particular function signature. We talk a lot about controllers in this unit, and we know that the component itself is a view.
How does the replace ( ) method in JavaScript work?
Jump to: The replace() method returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. If pattern is a string, only the first occurrence will be replaced.
How is handleclick connected to the Lightning button?
Remember that handleClick is connected to our tag and its onclick attribute. The event, then, is someone clicking the button. Inside that event it has the notion of a source, the thing that generated the event, which is the button itself.
Is it safe to use inline JavaScript in Lightning?
Inline JavaScript is not blocked by the CSP but is blocked in the security review as future CSP settings will not allow unsafe-inline. Do not write any code using inline JS in order to prevent your components from malfunctioning when CSP is tightened.
How are component helpers similar to a controller?
Component helpers are declared with a similar syntax to controllers, as an object containing a map of name:value pairs. (And, you guessed it, they’re separated by commas just like the controller.) However, there are a few differences you need to know about.
What’s the difference between helper and controller in JavaScript?
Helper functions are local to a component, improves code reuse, and moves the heavy lifting of JavaScript logic away from the client-side controller where possible.
What’s the difference between lightning and Visualforce compnent?
Optional : Apex Extensions – These are used to perform logical operations that are not housed within the standard or custom controller. Lightning was designed to follow an App-Centric model. This essentially means that it has been designed to create self-contained components that build on top of each other.