I am currently learning about Backbone.js and following along with the PeepeCode backbone.js basics video.
While attempting to fetch the collection in Chrome's Javascript console, I encountered the following error:
Uncaught TypeError: Cannot use 'in' operator to search for 'id' in [{
The JSON data I am working with is as follows:
[
{
"id": "1",
"title": "Bound - Zen Bound Ingame Music",
"artist": "Ghost Monkey"
},
{
"id": "2",
"title": "Where the Earth Meets the Sky",
"artist": "Tom Heasley"
}
]
Here is the code for my Collection:
window.Albums = Backbone.Collection.extend({
model: Album,
url: '/services/AlbumsService'
});
Any suggestions or ideas as to why this error is occurring? I have confirmed that there is an 'id' field in the JSON data, so I'm unsure of what could be causing this issue. Thank you for any assistance!