diff --git a/example/client-server/models.js b/example/client-server/models.js index 270ce90f..7249c6b7 100644 --- a/example/client-server/models.js +++ b/example/client-server/models.js @@ -15,7 +15,8 @@ var CartItem = exports.CartItem = loopback.PersistedModel.extend('CartItem', { }); CartItem.sum = function(cartId, callback) { - this.find({where: {cartId: 1}}, function(err, items) { + this.find({where: {cartId: cartId}}, function(err, items) { + if (err) return callback(err); var total = items .map(function(item) { return item.total();