I am facing a challenge with populating a dropdown menu with prices using AngularJS. The JSON structure provided is complex and I cannot modify it due to its association with a legacy system.
Below is a snippet of the JSON data:
[
{"name" : "simpleObjectName", "price" : "27.00"},
{"name" : "simpleObjectName2", "price" : ["26.99", "27.00", "28.00"]},
{"name" : "complexObjectName1", "availability" : { "price" : ["25.59", "26.40", "27.50"], "availability" : "AVAILABLE"}},
{"name" : "complexObjectName2", "availability" : { "price" : ["42.99", "22.00", "237.00"], "availability" : "UNAVAILABLE"}},
{"name" : "complexObjectName3", "availability" : { "price" : ["23.99", "216.00", "21.00"], "availability" : "UNAVAILABLE"}},
{"name" : "complexObjectName4", "availability" : { "price" : "21.00", "availability" : "AVAILABLE"}}
]
My goal is to display the prices of simple objects in the dropdown, along with the prices of complex objects that are marked as AVAILABLE under availability.
As a newcomer to Angular, I am unsure if there is a solution to handle price visibility within this complex JSON format. Are there any tools or techniques available for achieving this? I initially experimented with filters but encountered errors that forced me to reverse my changes.
EDIT: JSON update reveals the existence of multiple prices linked to offers and color variations. All prices for both available simple and complex objects must be displayed.