使用Loopback框架,我想在编辑Item
之前执行一些操作,因此我尝试这样做,但无法将其绑定到更新挂钩。Loopback beforeRemote for PUT请求
Item.beforeRemote("update", function(ctx,myitem,next) {
console.log("inside update");
});
而是更新我与updateAttributes试过的,updateById,创建,但没有工作。这种beforeRemote钩子在POST上创建效果很好,但在编辑过程中无法通过PUT获得。 我最后一个解决方案是再次检查methodString与通配符钩,但我想知道是否有任何记录,我找不到。
Item.beforeRemote("**",function(ctx,instance,next){
console.log("inside update");
});
你试过“* .save”作为方法名吗? – Jack
*。保存是一个操作钩子我对远程钩子感兴趣 –