Skip to content

Instantly share code, notes, and snippets.

@FranckErnewein
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FranckErnewein/9597528 to your computer and use it in GitHub Desktop.
Save FranckErnewein/9597528 to your computer and use it in GitHub Desktop.
var Backbone = require('backbone');
var najax = require('najax');
//set ajax fonction in node
Backbone.ajax = najax;
//create a collection
var Users = Backbone.Collection.extend({
url: 'https://raw.github.com/FranckErnewein/perso/master/www/data/work.json',
});
var users = new Users();
users.on('add', function( model ) {
console.log( 'add model', model.get('title') );
});
users.fetch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment