/public/js/Collection.js
https://bitbucket.org/P0PE/backbone-training-part2 · JavaScript · 17 lines · 17 code · 0 blank · 0 comment · 0 complexity · c22df0c1537dccda4859bc35caaaed8b MD5 · raw file
- define(['backbone','Model', 'jquery', 'underscore', 'dustjs-linkedin'], function(Backbone, Model, $, _, dust) {
- var Collection = Backbone.Collection.extend({
- initialize: function () {
- console.log("collection initialized");
- },
- model: Model,
- url: 'http://tiy-fee-rest.herokuapp.com/collections/pope5',
- toJSON: function(){
- var arr = [];
- _.each(this.models, function() {
- arr.push(model.toJSON());
- });
- return arr;
- }
- });
- return Collection;
- });