0

I am just getting started with Angular and I have run into an issue with my app.js where I have an array within an array. I would like to create an array for coordinates within my product array which I currently have set up like this:

var products = [{
    name: "Product 1",
    description: "",
    coords: [
        {
            top: 683,
            left: 626
        },
            top: 926,
            left: 600
        },
            top: 320,
            left: 750
        }
    ],
    videos: "video1"
}, {
    name: "Product 2",
    description: "",
    coords: [
        {
            top: 356,
            left:580
        },
            top: 600,
            left: 166
        },
            top: 470,
            left: 590
        }
    ],
    videos: "video2"
}];

When I have the coords array in app.js, my HTML is not rendering(just shows the angular expressions), but when I remove the coords array, it renders correctly. I am not currently doing anything with the coords, they're just there for future use, would that prevent the HTML from rendering correctly, or is there some sort of formatting issue?

0

1 Answer 1

2

your property coords is wrong format

coords: [
        {
            top: 356,
            left:580
        },
            top: 600,
            left: 166
        },
            top: 470,
            left: 590
        }
    ],

it misses the {

  coords: [
        {
            top: 356,
            left:580
        },{
            top: 600,
            left: 166
        },{
            top: 470,
            left: 590
        }
    ],
Sign up to request clarification or add additional context in comments.

1 Comment

Whoops! Can't believe i missed that. Thank you!!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.