[Vuejs]-Associative Arrays – accessing parameters

3👍

Seems that you’re using text interpolation with mustaches. In that case I don’t think you need this. Try ..

{{categories['catId'].header}}

1👍

Seems to work fine.

var id = "51bd55834e8d79bfd458ff8a156e3c11"
var categories = {
    "51bd55834e8d79bfd458ff8a156e3c11": {
        "header": "Header One",
        ".key": "51bd55834e8d79bfd458ff8a156e3c11"
    },
    "eb4312829f9c57b55727b4d8c6ca1ec7": {
        "typeId": "ba86f15d5b2126ac3d0ad39feeb5f400",
        "header": "Header Two",
        ".key": "eb4312829f9c57b55727b4d8c6ca1ec7"
    }
};
console.log(categories[id].header);

Leave a comment