[Pkg-javascript-commits] [backbone] 56/173: fix modelId example
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 07:44:01 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository backbone.
commit 8011b5c75b60a88a61abe0a3779b70b1b2bbeda9
Author: Adam Krebs <amk528 at cs.nyu.edu>
Date: Thu Nov 12 14:41:53 2015 -0500
fix modelId example
---
index.html | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/index.html b/index.html
index c484b70..1c30fcc 100644
--- a/index.html
+++ b/index.html
@@ -1796,19 +1796,19 @@ var Library = Backbone.Collection.extend({
var Library = Backbone.Collection.extend({
modelId: function(attrs) {
if (attrs.type === 'dvd') {
- return 'dvd-' + attrs.dvd_id;
+ return 'dvd' + attrs.dvd_id;
} else {
- return 'vhs-' attrs.vhs_id;
+ return 'vhs' + attrs.vhs_id;
}
}
});
var library = new Library([
- {type: 'dvd', dvd_id: 1},
- {type: 'vhs', vhs_id: 1}
+ {type: 'dvd', id: 1},
+ {type: 'vhs', id: 1}
]);
-alert(library.get('dvd-1').id + ' ' + library.get('vhs-1').id);
+alert('dvd: ' + library.get('dvd1').id + ', vhs: ' + library.get('vhs1').id);
</pre>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list