I’m trying to add a link to a text in a repeater using one of the suggestions in this forum:
import winLocation from 'wix-location';
$w.onReady(function () {
$w('#yourRepeater').onItemReady((selector, itemData, index) => {
$w('#YourTextElement').onClick(() => {
winLocation.to(itemData.url);
});
});
});
When i’m previewing my site I get the following error:
Wix code SDK error: The url parameter that is passed to the to method cannot be set to the value . It must be of type string.
What am I doing wrong?
1 Like
Thanks so much @anastasiias
@anastasiias I can’t do anything. Could you fix my code? It gives error that says there is no page with this url. However, the pages ending with these are available on live server.
import wixLocation from 'wix-location';
import wixData from 'wix-data';
$w.onReady(async function () {
});
export function dataset1_ready() {
makeRepeater();
console.log("The dataseet is ready")
}
export function makeRepeater() {
$w("#repeater1").forEachItem(($item, itemData, index) => {
$w('#text384').onClick(() => {
wixLocation.to("/e-sports/{url}");
});
});
}