Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The collection....
- var Stopcodes = Backbone.Collection.extend({
- model: Stopcode,
- url: function() {
- var api = stopselector.API_ROOT;
- var agency_id = Agency.get('id');
- return api + '/agencies/' + agency_id + '/stopcodes/9269';
- },
- parse: function(response) {
- return response;
- }
- });
- // The model...
- var Stopcode = Backbone.Model.extend({
- defaults: function() {
- return {
- id: '5650',
- lat: null,
- lon: null,
- name: null,
- code: null,
- hidden: false,
- showDestinationSelector: true,
- route: null,
- directions: []
- };
- }
- });
- // The fetch call to the collection (this is done in another file)...
- Stopcodes.fetch({
- reset: true,
- error: this.errorHandler,
- success: function(collection, response, options) {
- console.log("@Stopcodes.fetch()");
- console.log("collection = ");
- console.log(collection);
- console.log("response = ");
- console.log(response);
- console.log("options = ");
- console.log(options);
- console.log("\n");
- _.each(response, function(r) {
- console.log(r);
- stopcodes.push(r);
- });
- console.log(stopcodes);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement