Using Backbone.js I need to process an array of strings returned from a JSON web service. Should I create a Backbone collection to get this list? Here is the data I get from the web service:
["Question Designer","Adaptive Question Designer","Clickable image map","Essay","Fill in the blanks","Maple-graded","Matching","Mathematical formula","Multipart question","Multiple choice","Multiple selection","Numeric","Palette-based symbolic editor","True/false","Other"]
I created this simple collection to retrieve data:
var questionTypesCollection = Backbone.Collection.extend({ url: function() { return apiBase + '/questions/types'; } });
But when I try to get () the collection, I get this error:
Uncaught TypeError: Cannot use 'in' operator to search for 'id' in Question Designer
Backbone seems to be trying to parse strings as a model, instead of seeing that it's just a string. How can I get data into a collection so that I can use it in a view?
source share