停止代码返回模型列表 var models = app.models();
models.forEach(function(Model) {
console.log(Model.modelName);
});
User
AccessToken
ACL
RoleMapping
Role
Registration
Assets
当我使用fallowing代码来使用注册或Asstes时:
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
答案 0 :(得分:2)
我不是环回专家,但请尝试以下代码:
var Registration = app.models.Registration;
console.log(Registration);
app.model(Registration);
答案 1 :(得分:1)
用户是型号名称。
class RenderingEngine
{
private:
Cone cone = Cone(OpenglESVersion::OES2); // With =, you can use parent on right side
};
resetPassword是用户模型的功能名称 取两个参数 new_pwd 和令牌,
var user = app.models.User;