如何将模型设置为环回的variables?

休闲代码返回模型列表var models = app.models();

models.forEach(function(Model) { console.log(Model.modelName); }); User AccessToken ACL RoleMapping Role Registration Assets 

当我使用休闲代码来使用注册或分配:

 D:\apps\newapps\testapp\node_modules\loopback\lib\application.js:129 assert(Model.prototype instanceof Model.registry.getModel('Model'), ^ TypeError: Cannot read property 'prototype' of undefined at Function.app.model (D:\apps\newapps\testapp\node_modules\loopback\lib\application.js:129:17) at Object.<anonymous> (D:\apps\newapps\testapp\server\server.js:38:5) at Module._compile (module.js:573:30) at Object.Module._extensions..js (module.js:584:10) at Module.load (module.js:507:32) at tryModuleLoad (module.js:470:12) at Function.Module._load (module.js:462:3) at Function.Module.runMain (module.js:609:10) at startup (bootstrap_node.js:158:16) at bootstrap_node.js:598:3 

用户是型号名称。

 var user = app.models.User; 

resetPassword是用户模型的函数名,它带有两个参数new_pwdtoken

 user.resetPassword({ new_pwd: new_password, token }, (err, data) => { if (err || !data.status) { return err || data; } else { return data; } }); 

我不是专家的回环,但尝试下面的代码:

 var Registration = app.models.Registration; console.log(Registration); app.model(Registration);