Oliver White
Oliver White

Reputation: 99

v-for Property or method is not defined on the instance

I have a component called in another component witch use a v-for loop. But I can't get the property in the loop and don't understand why.

here is the code https://jsfiddle.net/playoutprod/octw411z/1/

Trouble append on this line (17) :

<td v-for="h in hs"/>{{h}}</td>

I tried this :

<td v-for="h in hs" :h="h"/>{{h}}</td>

witch render correctly with same error (but shows that "hs" array is well populated)

    <tr>
      <td h="date debut"></td>
      <td h="date fin"></td>
      <td h="formateur"></td>
      <td>En savoir +</td>
   </tr>

Upvotes: 0

Views: 558

Answers (1)

acdcjunior
acdcjunior

Reputation: 135762

In the code:

<td v-for="h in hs"/>{{h}}</td>

You are closing your td in />.

So the code above is actually:

<td v-for="h in hs"></td>{{h}}</td>

Which is why you get h as undefined.

Fix: Don't close the td:

<td v-for="h in hs">{{h}}</td>

Updated JSFiddle here.

Upvotes: 2

Related Questions