I'm working in a vue file inside of a Symfony project and I want to find the absolute path from a route. Usually I do something like this:
this.$http({
url: 'products/edit/'+product.id,
method: 'PUT',
params : params
[...]
and it works great. But now I don't need to use this.$http because I'm trying to do this:
<div>
{{ getUrl(product) }}
</div>
and I have my function:
getUrl(product) : {
let url = '/products/edit'+product.id
return url
}
but obviously it only displays /products/edit/xxx
instead of mysite.com/products/edit/xxx in production or localhost/products/edit/xxx in local.
In my routing file I have:
update_product:
path: /products/edit/{product}
defaults: { _controller: RBProductsBundle:Product:edit }