【发布时间】:2018-03-21 17:57:13
【问题描述】:
伙计们,我是环回新手,所以不知道该怎么做。这是我的代码
module.exports = function(Customer) {
Customer.beforeRemote('create', function (ctx, user, next) {
var companyprofile=app.models.customerdetail
companyprofile.create(ctx.args.data.cust_cmp_profile,user,next)// is this possible to pass selected value to model customerdetail
console.log(ctx);
});
};
这两个模型是不相关的,所以我在这里在 Customer 中调用 customerdetail 模型,我尝试使用 customerdetail 的 create 方法,但不知道该怎么做。我搜索了很多,但没有任何东西我怎么能做到这一点
【问题讨论】:
-
我相信你想要这里的“处理数据”文档:loopback.io/doc/en/lb3/Working-with-data.html。这描述了如何通过服务器端 API 对数据进行 CRUD。
-
@RaymondCamden 我在客户模型中调用customerdetail ..您提供的链接没有提供任何示例。你能给我任何与我的问题相关的例子吗?谢谢你的帮助
标签: loopbackjs strongloop