Merge pull request #2973 from strongloop/remote_method_fix_example
Fix remote method example
This commit is contained in:
commit
2c1ebdcc2e
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue