Sails.js资产交付到http

时间:2015-11-02 10:08:33

标签: javascript node.js sails.js

我是sails and node的新手,我对如何使用ejs标签<% - %>在网页上通过控制器交付模型有疑问或<%=%>。 所以,我有两个模型,他们的控制器Model1,Model2和Model1Controller,Model2Controller。 我想在Model2Controller show / findall操作中显示Model1属性(让我们说名字为Model1.name)。

1 个答案:

答案 0 :(得分:1)

模型在风帆中是全局的,即您可以在Model2Controller中访问someMethodInModel2Controller: function(req, res) { Model1.find({}, function(err, foundRecords){ // Do whatever you want to do with the records from Model1 } } 。例如

/opt/zbstudio/bin/linux/x64/lua version is LuaJIT 2.0.2
"lua" command alone points to /usr/bin/lua, and it is Lua 5.1.5
~/torch/install/share/lua/5.1 seemed to contain Lua 5.1
~/torch/install/bin/luajit is 2.1.0-alpha