0

I want to add a parameter to a URL inside a href attribute. I'm using Vue js and those parameters should be dynamic. How can I do this?

<a href="localhost/doctors?{{ dynamic content }}"> 

or

<a href="localhost/doctors?${"dynamic content"}>

not working. Vue gives me an error that I should bind it. but I tried it too. Couldn't make it work. what is the correct way? I'm a newbie to Vue js.

1 Answer 1

3

You should use backticks inside the quotes and add data binding on href.

<a :href="`localhost/doctors/${dynamic_content}`">

In the above, the dynamic_content can be a computed, data, props or any other reactive property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.