[英]Mean.js Multiple Layouts, Server or Angular Layout
I've been developing a mean.js application. 我一直在开发一个mean.js应用程序。 I have an admin theme that I'm trying to integrate with the existing application.
我有一个管理主题,我正在尝试与现有的应用程序集成。
My question is 我的问题是
Let say I have an Index.html file, if the intended route is Dashboard, I just replace a section of the page view, ( Ruby on Rails Developers would know this) 假设我有一个Index.html文件,如果预期路由是Dashboard,我只是替换页面视图的一部分,(Ruby on Rails Developers会知道这个)
UPDATE 1 : I've created 2 files with my required Admin Index, and Layout files. 更新1 :我用我需要的管理员索引和布局文件创建了2个文件。
admin.index.server.view.html
and 和
admin.layout.server.view.html
I've also added the following code in my core.server.routes.js 我还在core.server.routes.js中添加了以下代码
module.exports = function(app) {
// Root routing
var core = require('../../app/controllers/core');
app.route('/').get(core.index);
app.route('/admin/').get(core.adminIndex);
};
I've also added the following code in my core.server.controller.js 我还在core.server.controller.js中添加了以下代码
exports.adminIndex = function(req, res) {
res.render('admin.index', {
user: req.user || null
});
};
and when I hit localhost:3000/admin/ I get Error: Cannot find module 'index' 当我点击localhost:3000 / admin /我得到错误:找不到模块'索引'
Rename the two view files from admin.index.server.view.html
and admin.layout.server.view.html
to admin-index.server.view.html
and admin-index.server.view.html
respectively. 将
admin.index.server.view.html
和admin.layout.server.view.html
的两个视图文件分别重命名为admin-index.server.view.html
和admin-index.server.view.html
。
Also, change this line in your core.server.controller.js
file; 另外,在
core.server.controller.js
文件中更改此行; res.render('admin.index', {
to this; 对此;
res.render('admin-index', {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.