function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shweta kumari 25shweta kumari 25 

call a lightning component from a custom button

I am not an expert in lightning components, so I had to post this question.

In lightning, I have an app page. There a is a primarycomponent kept on the lightning page.

PrimaryComponent.cmp
----------------------------
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"
                access="global" >
 <lightning:button label="Neutral" 
                             title="Neutral action" 
                             onclick="{!c.handleF1Comp}"/>
</aura:component/>

Now I have another component say F1Comp.cmp

<aura:component implements="flexipage:availableForAllPageTypes"
                access="global" >
 <h1> I am F1 Comp </h1>
   </aura:component/>

My requirement is when I click the button In primarycomponentit should call the f1Comp.

How to achieve this?

Please eloborate and suggest approaches.
Thanks
shwet
Raj VakatiRaj Vakati
You need to use lightning:isUrlAddressable interface extends the lightning:hasPageReference interface. A component that implements lightning:isUrlAddressable then gets access to the page state through the pageReference attribute. The page state is a representation of the current URL query parameters.


Refer this link 

https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation
Raj VakatiRaj Vakati
Code
F1Comp.cmp
<aura:component implements="flexipage:availableForAllPageTypes,lightning:isUrlAddressable"
                access="global" >
 <h1> I am F1 Comp </h1>
   </aura:component/>
 
PrimaryComponent.cmp
----------------------------
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"
                access="global" >
  <aura:attribute name="pageReference" type="Object"/>
 <aura:handler name="init" value="{! this }" action="{! c.init }"/> 
<lightning:navigation aura:id="navService"/> 
<lightning:button label="Navigate" onclick="{!c.handleClick}"/>
</aura:component/>

Controller : 

​

    init : function(component, event, helper) {
        var pageReference = {
            type: 'standard__component',
            attributes: {
                componentName: 'c__F1Comp',
            },
            state: {
                 
            }
        };
        component.set("v.pageReference", pageReference);
     },
     handleClick: function(component, event, helper) {
        var navService = component.find("navService");
        var pageReference = component.get("v.pageReference");
        event.preventDefault();
        navService.navigate(pageReference);
    }

 
Abigail PenningtonAbigail Pennington
I hope that all the salesforce's can find solutions to our problems..

_____________________________________________________
https://www.mcdvoice.onl

 
Ajay K DubediAjay K Dubedi
Hi shweta,

Try this one out:
PrimaryComponent.cmp-->
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"
                access="global" >
 <lightning:button label="Neutral" 
                             title="Neutral action" 
                             onclick="{!c.handleF1Comp}"/>
</aura:component/>
PrimaryComponentController.js--->
({ handleF1Comp:function (c ,e, h) {
        var evnt = $A.get("e.force:navigateToComponent");
        evnt.setParams({
            componentDef  : "c:F1Comp",
            componentAttributes: { }
    });
        evnt.fire();
    }
})
F1Comp.cmp------>
<aura:component implements="flexipage:availableForAllPageTypes"
                access="global" >
 <h1> I am F1 Comp </h1>
   </aura:component/>

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
 
brad leebrad lee
You explained in a detailed way about this and thanks for sharing this to us. Check this for more details about the customer feedback survey. www.homedepot.com/survey (https://succeedfoundation.org/homedepot-survey)
zainab khanzainab khan
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"
                access="global" >
 <lightning:button label="Neutral" 
                             title="Neutral action" 
                             onclick="{!c.handleF1Comp}"/>
</aura:component/>
PrimaryComponentController.js--->
({ handleF1Comp:function (c ,e, h) {
        var evnt = $A.get("e.force:navigateToComponent");
        evnt.setParams({
            componentDef  : "c:F1Comp",
            componentAttributes: { }
    });
Please try this!!tellthebell (https://surveyforcustomers.com/tellthebell-com/)
joeytrib bianijoeytrib biani
hotmail login (https://hotmail.best/) You explained in a detailed way  walmartone (https://walmartone.tech/) Please try this!!tellthebe https://survey-feedback.net/ above solution helpful. If it does, please mark as Best Answer to help others too.
johnson eaterjohnson eater
access into iCloud Photos on iPhone (https://icloudlogin.co/)
johnson eaterjohnson eater
mkolq lolsmkolq lols
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"
04                access="global" >
05  <aura:attribute name="pageReference" type="Object"/>
06 <aura:handler name="init" value="{! this }" action="{! c.init }"/>
07<lightning:navigation aura:id="navService"/>
08<lightning:button label="Navigate" onclick="{!c.handleClick}"/>
09</aura:component/>
Webmail (http://www-hotmail-com.email/)
johns martjohns mart
halaman jethohalaman jetho
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"
                access="global" >
 <lightning:button label="Neutral" 
                             title="Neutral action" 
                             onclick="{!c.handleF1Comp}"/>
</aura:component/>
PrimaryComponentController.js--->
({ handleF1Comp:function (c ,e, h) {
        var evnt = $A.get("e.force:navigateToComponent");
        evnt.setParams({
            componentDef  : "c:F1Comp",
            componentAttributes: { }
    }); 

i have use on :  hotmail.com login  (https://hotmail-loign.com/www-hotmail-com/)
tony stark 80tony stark 80
Try this one out:
PrimaryComponent.cmp-->
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"
                access="global" >
 <lightning:button label="Neutral" 
                             title="Neutral action" 
                             onclick="{!c.handleF1Comp}"/>
</aura:component/>
 ePayItOnline (https://ranvex.com/)
adam levine 35adam levine 35
Thanks for the post. Visit Wendy's restaurant and win cash offers and prices. Check our website for more information: Wendy's.com (https://talktowendysurvey.com/)
Billy BoudenBilly Bouden
you must need a coin supplyer for coin master game. Here it is: (https://coinmaster.breakingbio.com/)
Jerry BrottJerry Brott
Thanks for this knowledgable post. Getmyoffer.capitalone.com (http://getmyoffer.pro/) | Capital one Credit Card Details
cris millcris mill
Nice to see this post here and thanks for sharing this to us. The Cinderella Solution is a women-only weight loss system designed around a simple and practical flavour-paring method that removes the need for calorie. Get Cinderella Solution Review here.  https://cinderellasolution.guru
Mahendra Kumar 100Mahendra Kumar 100
There is complete information about TCS ultimatix which can be access from TCSUltimatix.net (https://www.tcsultimatix.net/) you can enjoy it too.
mill panmill pan
Twitch TV is a streaming platform for gamers. Twitch TV broadcast gameplay videos as well as live gameplay over the server. Create an account you can either do this by going to the twitch.tv/activate and then create an account or you can download the application from the official website and then create the account.  https://kinetichifi.com/twitch-tv-activate/
jordan sewingjordan sewing
knowledgeable information. Thanks to salesforce Roller Blinds & Plantation Shutters Newcastle (http://www.factoryblindsplantationshutters.com.au/blinds-shutters-newcastle/)
simone rainesimone raine
I hope that all the salesforce's can find solutions to our problems..
thanks i found a solution 
https://www.tcswebmail.info/ https://www.dadeschools.one/ https://www.upsers.fyi/
 
thomas richard 5thomas richard 5
You clarified in a nitty gritty path about this and much obliged for sharing this to us. Check this for additional insights regarding the client input review.https://thumzap.com/
Oliver Oliver 2Oliver Oliver 2
A detailed guide to get you through the stages of using spotify. The problems will be over once you use the guide.
https://howtousespotify.com/
Nasikaa ikaaNasikaa ikaa
Wendy’s Breakfast Menu (https://wendysbreakfastmenu.info/) – Wendy’s is an American international fast food restaurant chain. On November 15, 1969, Wendy’s was founded by Dave Thomas in Columbus, Ohio.
robejar yarobejar ya
Burger King is an American multinational (https://burgerkingbreakfastmenu.info/)chain of fast-food restaurants. Burger King is the third-largest hamburger fast-food chain in the country.
It is recognized for its signature burger, “The Whopper,” its instantly recognizable logo, and locations all over the USA and beyond, it is a big part of American restaurant culture.
jems bondjems bond
Looking for Col campus Login– Join Code, Student Login, Boston, Enroll, and other page details. So, please check the useful details you should know, along with the concerning page links provided below;-
http://logina2z.com/how-to-colcampus-login-portal/
jems bondjems bond
State Auto Connect employee login 
hello friends,
State Auto Connect Login – Here in this article, you will get to learn about how to login into the State Auto Connect Login portal.
So please read this article, at last, and learn about the State Auto Connect and various other proceedings.
Let’s get started…
http://logina2z.com/state-auto-connect-login/
jems bondjems bond
Wright – Patt Credit Union employee login 
hello friends,
Wright – Patt Credit Union  Login – Here in this article, you will get to learn about how to login into the Wright – Patt Credit Union Login Portal.
So please read this article, at last, and learn about the Wright – Patt Credit Union Login and various other proceedings.
Let’s get started…
http://logina2z.com/wright-patt-credit-union-login/
jems bondjems bond
City Credit Union employee login 
hello friends,
City Credit Union Login – Here in this article, you will learn how to log into the City Credit Union Login portal.
So please read this article, at last, and learn about the City Credit Union Login and various other proceedings.
Let’s get started…
http://logina2z.com/city-credit-union-login/
jems bondjems bond
hello friends,
Welcome to another helpful informatic article about the aaa of Alabama membership login
In this article, we will talk about the aaa of Alabama membership login portal’s login requirements, a step-wise guide, and basic information about the portal.
You probably know that AAA offers outstanding roadside assistance to AAA Members in a jam. But did you know since its start, AAA has advocated for safe, efficient highways and has offered services to make car ownership and travel more enjoyable?
http://logina2z.com/aaa-alabama-membership-login/
Starbucks menuStarbucks menu
This is a really informative discussion. https://starbucks-secret-menu.online/
denial bhvyalisdenial bhvyalis
very informative article for me to help to open https://makeyourmands.info/
Saint Otis 9Saint Otis 9
That is all the helpful information I needed. I appreciate you sharing. Vampire Survivors (https://vampire-survivors.io) will take you on a fun filled entertainment time. Kill all zombies rushing towards you

 
Tom John 11Tom John 11
McDVOICE (https://mcdsvoices.com/): Hello and welcome to the survey online portal McDVOICE Survey on www.mcdvoice.com (https://mcdsvoices.com/) official website. The goal of the survey is to ensure that the high quality and standards align with the customers’ needs.