0

I have a following JSON data

[Beds = [
    ElectricHospitalBed = [{name: 'Multifunctional electric hospital bed', code: 'IHC B/E 1001'},
        {name: 'Multifunctional electric hospital bed', code: 'IHC B/E 1002'},
        {name: 'Five functional electric hospital bed with ACP', code: 'IHC B/E 1003'},
        {name: 'Five functional electric hospital bed', code: 'IHC B/E 1004'},
        {name: 'Five functional electric hospital bed with ACP', code: 'IHC B/E 1005'},
        {name: 'Five functional electric hospital bed', code: 'IHC B/E 1006'},
        {name: 'Three functional electric hospital bed', code: 'IHC B/E 1007'},
        {name: 'Three functional electric hospital bed', code: 'IHC B/E 1008'},
        {name: 'Five functional electric hospital bed', code: 'IHC B/E 1009'}],
    Semi electric hospital bed = [],
    Manual hospital bed = [],
    Home care bed = [],
    Orthopedics bed = [],
    Childrens bed] = [],
Trollies = [Patient trolley = [],
    Stretcher = [],
    Nursing trolley [],
    Cambered trolley=[]]
]

I have to list all the names of products(given that each of the object is a product) by AngularJS ng-repeat attribute. Please advice.

Note: this JSON data is assigned to a variable named products in a controller called ProductsData.

2
  • data what you provided Its not in valid json format.can you correct and post the valid one Commented Feb 27, 2016 at 7:01
  • do mark as answered once solved (: Commented Feb 27, 2016 at 7:02

2 Answers 2

1

is it like [Beds = [{},{}],[{},{}],[{},{}], Trolleys = [],[],[],]

<div ng-repeat="c in products"> 
   <div ng-repeat="p in c"> 
   {{c.name}}
   </div>
</div>

c is categories in products ie beds, trolleys etc

p is item in each category,

and c.name should get you what you need.

Sign up to request clarification or add additional context in comments.

Comments

0

correct your json format in question.

anyways i changed and implimented in jsbin here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.