Merge pull request #2973 from strongloop/remote_method_fix_example

Fix remote method example
This commit is contained in:
Amirali Jafarian 2016-11-22 17:55:07 -05:00 committed by GitHub
commit 2c1ebdcc2e
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) { 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 var total = items
.map(function(item) { .map(function(item) {
return item.total(); return item.total();