+ Start a Discussion
Sunil SirangiSunil Sirangi 

Lightning Component Framework Specialist SuperBadge - Issue with Step 8

Guys, In challenge 8, i was struck at the point of hyperlinking the CreatedBy to redirect to user detail page. How do we define hyperlinks in lightning. Can anyone share any info on this part.
Medhanie Habte 37Medhanie Habte 37
This should do it!
Controller Method
onUserInfoClick : function(component,event,helper){
        var userId = event.currentTarget.getAttribute("data-userid");
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId" : userId,
        });
        navEvt.fire()
Relevant CMP Code
div class="slds-media__body">
                        <div class="slds-grid slds-grid_align-spread slds-has-flexi-truncate">
                            <p><a href="javascript:void(0)" onclick="{!c.onUserInfoClick}" data-userid="{!boatReview.CreatedBy.Id}">
     {!boatReview.CreatedBy.Name}
</a>
                                — {!review.CreatedBy.CompanyName}
                            </p>