The Developer Console lets you create and edit Lightning components, with access to other powerful Force.com development tools.
Follow these steps to create a Lightning component in the Developer Console. You’ll also create a Lightning app as a container for the component.
- Open the Developer Console by clicking Your Name | Developer Console.The Developer Console opens in a new window.
- Click File | New | Lightning Component.
- Enter firstComponent for the name of the new component, and click OK.This creates a firstComponent.cmp resource.
- In the editor, enter the following markup for the component.
My First Lightning Component!
5. Click File | Save. 6. Create a Lightning app. Click File | New | Lightning Application. 7. Enter helloWorldApp for the name of the new app, and click OK. 8. This creates a helloWorldApp.app resource. 9. In the editor, enter the following markup for the app, which embeds the component you created in a Lightning app.
c:helloWorld refers to the component helloWorld.cmp using the default namespace c. If your organization has a registered namespace, you can use it to reference Lightning components, such asmyNamespace:helloWorld.
9. To see your app, click Preview.
The app opens in a new window.
A .app resource can’t be included in Salesforce1 but a .cmp resource can. You can embed your components in a .app resource to preview it as a standalone app outside of Salesforce1.
To see a list of existing Lightning resources, click File | Open Lightning Resources.
Leave a comment