Fix remote method example

- callback error and not ignore cartId
This commit is contained in:
Amir Jafarian 2016-11-22 14:24:19 -05:00
parent c3ab932012
commit 9f4e9d8532
1 changed files with 2 additions and 1 deletions

View File

@ -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();