0

I'm trying to get color_name from colors.standard. I have try as given below html but both are showing same array.

HTML - Not Working

<div data-bind="foreach: { data: doorColorList, as: 'column' }">
    
    <span class="style-name" data-bind="text: name"></span>
        
    <div data-bind="foreach: { data: column.colors.standard, as: 'section' }">
        
            <p data-bind="text:console.log(section)"></p> 
      
    </div>
</div>

HTML Not Working

<div data-bind="foreach: { data: doorColorList, as: 'column' }">
        
    <span class="style-name" data-bind="text: name"></span>
        
    <div data-bind="foreach: { data: column.colors.standard, as: 'section' }">
        <div data-bind="foreach: { data: section, as: 'colorsection' }">
      
            <p data-bind="text:console.log(colorsection)"></p> 
        </div>
    </div>
</div>

Console JS Array:

{
    "style_id": "3",
    "name": "Rockford",
    "colors": {
        "standard": {
            "27": {
                "style_id": "3",
                "color_id": "27",
                "color_name": "White",
                "color_group": "1",
                "sort_order": "2",
                "defaultStyleId": "4"
            },
            "28": {
                "style_id": "3",
                "color_id": "28",
                "color_name": "Cloud White",
                "color_group": "1",
                "sort_order": "1",
                "defaultStyleId": "4"
            }
        },
        "doorcolor": {
            "18": {
                "style_id": "3",
                "cabinet_line_id": "1",
                "door_id": "1",
                "meta_keywords": null,
                "meta_description": null,
                "price_id": "3",
                "color_id": "18",
                "color_name": "Carbon",
                "color_group": "2",
                "sort_order": "8"
            }
        },
       }
    }
}

How can i get color_name from colors.standard?

Any help will be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.