Passing id value to href from Vue data
For passing a value from Vue data to href we just add the
value with href, but we must use v-bind to do this.
<div v-for="r in rentals"> <a v-bind:href="'/job/'+ r.id">{{ r.job_title }} </a> </div>
Or you can use the method shown below.
<div v-for="r in rentals"> <a :href="'/job/' + r.id">{{ r.job_title }}</a> </div>
Both the above works well. If you are using ES6 template
literal use the below code.
<a :href="`/job/${r.id}`">
Comments
0 comments
Please Sign in or Create an account to Post Comments