This should work assuming pack.id has a value - note the template string wrap the entire URL:
<a :href="`/edit_package/${pack.id}`" target="_blank">{{ pack.name }}</a>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to use classic a tag with wildcard in laravel using vue.js.
<a href="/edit_package/{{pack.id}}">{{pack.name}}</a>
The pack.name is showing as it should and if I will show pack.id it will show as well without any problem This is how the route in web.php looks like
Route::get("/edit_package/{id}",[\App\Http\Controllers\TaskController::class, "edit_package"]);
The problem is it instead of passing to wildcard value of pack.id as I would expected it passes {{pack.id}}. I tried many possibilities of this such as
<a :href="/edit_package/`${pack.id}`" target="_blank"></a>
or
<router-link :to="`/edit_package/${pack.id}`">
{{pack.name}}
</router-link>
But none of them worked as I wanted. I don't know what to do with this even so it looks so easy. Please how can I easily(I expect there should be some easy way to do this) do this.
This should work assuming pack.id has a value - note the template string wrap the entire URL:
<a :href="`/edit_package/${pack.id}`" target="_blank">{{ pack.name }}</a>
Please or to participate in this conversation.