Initially I thought creating Wikipedia Search component will be straight forward. I can simply use AJAX request from Lightning component to get result from Wikipedia using its REST API. Soon, I discovered about Content Security Policy in Lightning components developer guide.
If we attempt to use AJAX or REST API in Lightning component then below error will be thrown
Uncaught error in markup://ui:keyup : caught Failed to execute ‘open’ on ‘XMLHttpRequest’: Refused to connect to ‘https://en.wikipedia.org/w/api.php?action=opensearch&search=jitendra&limit=10&namespace=0&format=jsonfm’ because it violates the document’s Content Security Policy.
So, other workaround I came up is by using Apex controller to create HttpRequest and return result as JSON to lightning component. You can download this as unmanage package from this URL.
While developing Lightning component, all of us might have been noticed that default user interface for loading component looks like below image.
Most of us, for sure will want to customize this loading message to match their Salesforce implementation theme. We can use “Lightning Template” to override this message to show something like below image.
I tried to see, how can we login to Salesforce after Lightning design is enabled in Salesforce and found that below URL hack actually works, assuming we want to open Opportunity record after successful login. If you don’t want to redirect on any existing lightning page or record then you can simply ignore URL part after [SessionId]
How to create Radar chart using Lightning Component in Salesforce with the help of Chart.js library
To create Radar chart in lightning component, we will be using chart.js library. If you are new to lightning then please go through basics and also I would suggest to go through lightning trailhead modules.
As you might already know that next big change in Salesforce is introduction to lightning components. As technology is changing rapidly and to take advantage of cutting edge innovations in web technology, Salesforce doesn’t want to stay behind. If we see trend, all major platform has introduced component based design like Polymer, React, Web Components, Angular 2.
We will be discussing basics of Lightning components in this post and how Lightning application, component, controller, helpers and Apex controllers are connected with each other.
In Previous article, I have introduced what is Trailhead and why employer should start using it to train Salesforce developers and Admins. At the time of writing this article, there are already 16 modules to be learned from it.
Recently Salesforce has added some more awesome tutorial and In this article, I will walk-through “Lightning Component” module of Trailhead.
In this module, you will learn that what exactly is lightning component, Aura Framework and how it is different than visualforce?
This is UI framework to develope dynamic web pages for mobile and desktop devices in Salesforce. Its used mostly for SPA (Single Page Applications). It focuses on component based developement and reusing it. You can compare Lihtning component (by Salesforce) with React (by Facebook) and Polymer (by Google).