0

Javascript :

import { LightningElement, api } from 'lwc'; export default class ApcApiArticle extends LightningElement { @api prevPart; connectedCallback() { this.sfdcBaseURL = window.location.origin; let org = this.sfdcBaseURL; this.prevPart = org; } 

HTML :

 <template> <a href={prevPart}> Link to > </a> </template> 

.js-meta.XML :

<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>57.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightningCommunity__Default</target> <target>lightningCommunity__Page</target> </targets> <targetConfigs> <targetConfig targets="lightningCommunity__Default"> <property name="prevPart" label="URL Article " type="String" **default="prevPart"** /> 

i expose this component in community site , i want the default link to take the url but it doesn't work - Any solution?

1 Answer 1

1

The name of the property used in the meta file should be same as the public property created in the javascript file.

Javascript :

@api santePart; 

.js-meta.XML :

<property name="santePart" label="URL Article" type="String" default="https://salesforce.stackexchange.com" /> 
4
  • Yes it's , i copied the wrong variable . i want the default value to be dynamic .. Commented Jun 27, 2023 at 10:09
  • Try by removing the component from the community site, then publishing the site, again re-adding the component and re-publishing the site. Commented Jun 27, 2023 at 10:13
  • it doesn't worked .. it treats the variable as string Commented Jun 27, 2023 at 10:17
  • even with default = {!prevPart} doesn't worked , i think it's impossible .. Commented Jun 27, 2023 at 17:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.