0

I have a requirement in which i have to create a lightning component which can be used in any lightning APP in Salesforce org.

Example :

Created a component which display address info based on ZIP code. Component : showAddress

I want to use this showAddress component inside any app or component.

Is this possible ?

1

Yes you can, put this code in any lightning component or app:

<c:showAddress
        PARAMETER_TO_PASS = "VALUE"/>

Parameter passing is optional.

0

Yes it works as long as the page where this component is placed can provide zip code through some ways directly or through record id and this component has the below interface it can be included in any page through app builder

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
0

I want to use this showAddress component inside any app or component. Is this possible ?

Yes. This is possible using what we call as Component Composition. This is one of the features that you can use for use cases you have. Also take a look at Data Binding Between Components to understand how data is passed between components.

So if you want to include your showAddress component say in another component named addressDetails.cmp, the code in addressDetails.cmp will look like as:

<aura:component>
    ...
    <c:showAddress zipCode="{!v.zipCode}" />
</aura:component>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.