Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have a json-result with 5 categories that I want to loop over with v-repeat. I use the push-method to pass the result to my vue-model.

The setup is 5 different categories to which my records belong. Each category must be shown in a different tab (I removed the category-filter on my results cause is not related to the issue).

The records are showing perfectly (v-repeat="results") and I also get 5 tabs but no values (text neither value).

console.log(this.categories) gives me an array of 5 objects from which I don't succeed to show the properties...what am I doing wrong?

I tried all kinds of things like $value, categorie:categories, ...

JSON-result from my api-call over my categories:

{
    status: "success",
    data: {
        results: {
            general: "Algemeen",
            metadata: "Meta-data",
            facebook: "Facebook",
            twitter: "Twitter",
            googleplus: "Google+"
        }
    }
}

The fetching in my Vue-file:

fetchCategories: function(){
    this.$http.get('/api/tokens/categories', function (response) {

        for(var prop in response.data.results) {
            this.categories.push({text: response.data.results[prop], value: prop});
        }
    });
},

And my view:

<tabs>
    <tab v-repeat="category in categories" header="@{{ category.text }}">
        <div id="@{{ category.value }}">
            <table id="@{{ category.value }}-token-list" class="data-list">
                <tr>
                    <th>id</th>
                    <th>categorie</th>
                    <th>naam</th>
                    <th>slug</th>
                </tr>
                <tr v-repeat="results" v-class="odd: (index%2!=0)">
                    <td>@{{ id }}</td>
                    <td>@{{ category }} </td>
                    <td>@{{ name }} </td>
                    <td>@{{ slug }}</td>
                </tr>
            </table>
        </div>
    </tab>
</tabs>

EDIT:

I do get my value when I write this:

@{{ categories[0].text }} or @{{ categories[0].value}}

EDIT 2:

it is a problem with the tab-functionality from VueStrap. When I use just a list with @{{ value }} it all work just fine

share|improve this question
    
What version of VueStrap are you using. v1.0.0 is not compatible with vue 0.12.x – Aman Dec 22 '15 at 0:17
    
@Aman I am using the 0.12.x version. Fact is that it does work with a list but not with the tabs. Even when skipping VueStrap and working with the nav-tabs from bootstrap. – B Fly Design Dec 22 '15 at 0:25
    
A fiddle would really help in diagnosing this issue. Can you create one? – Aman Dec 22 '15 at 23:22
    
@Aman here I created a fiddle If you leave out the component part in the vm you will notice the values are rendered. – B Fly Design Dec 23 '15 at 11:50
up vote 0 down vote accepted

Seems to be a 0.12 issue. Upgrading to 1.0.x will be the solution!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.