I want the ‘id’ variable between ‘Contact’ and ‘view’, how should i do it to make it accessible dynamically?
Any simple solution that words would help……..
var id = 0x323214343;
<a href="https://develop.lightning.force.com/lightning/r/Contact//view">{doctor.Name}</a>
2
Answers
You’re gonna need to use some Javascript 🙂
Simply add an id property to your ancor element:
And then set it dynamically.
In the JS file of your lwc you could expose a getter for that url, which should be relative instead of an absolute one:
I assumed the Id is a property of
doctor
object.Then in template you should have:
Please note that
document.getElementById();
won’t work in LWC. Documentation: