I have been tying to include "url/hyperlink" within a checkbox "label" using lightning input, but to no avail. Given is what I have tried and with the results, I want "Terms and Service" part of the checkbox to appear as hyperlink with a URL.
Lightning CMP
<aura:attribute name="termsText" type="String" default=""/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<div class="slds-size_1-of-1 slds-medium-size_1-of-2 slds-m-bottom_small slds-p-horizontal_x-small ">
<lightning:input type="checkbox" label="{! v.termsText }" name="terms" value="{!v.chkTerms}" />
</div>
JS Controller
doInit : function(component, event, helper) {
var terms = "Yes, by creating an account I agree to the \<a href='#'\>Terms and Service.\</a\>";
component.set("v.termsText", terms);
}
Output
Desired Ouput
aura:unescapedHtml
orlightning:formattedRichText
for displaying the hyperlink