I have a Vue.component which creates a row in a table:
Vue.component('comment-row', {
props: ['comment'],
template: '<tr>' +
'<th>{{comment.authorName}}</th>' + // works fine
'<th>{{comment.value}}</th>' + // also works fine
'<th><form action="/remove_comment/{{comment.id}}">' + // problem here
'<button type="submit">X</button></form></th>' +
'</tr>'
});
The row looks like:
Author | Some message | Button 'X' to delete this row with unique action
And there is a problem here: Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead.
Ok, we do what we are asked:
<form v-bind:action="/remove_comment/comment.id">
But here another problem arises: Invalid regular expression flags in
Instead of a number I get string comment.id
The question is how to use ['comment'] prop correctly in a html tag action = "" in Vue.js?