I have been working on a mean.js application and I am currently trying to integrate an admin theme with the existing project.
My query is:
- Is it possible to have multiple server layouts? For example, can we use layout-1 for regular users and layout-2 for admin users?
- If having multiple server layouts is not feasible, is there a way to detect parameters or scope variables in the Angular client app and dynamically load a partial inside the main layout based on user type?
For instance, if I have an Index.html file, when navigating to the Dashboard route, I would like to replace a section of the page view (similar to how Ruby on Rails developers achieve this).
UPDATE 1: I have created two files: admin.index.server.view.html and admin.layout.server.view.html.
I have also added the following code to my 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);
};
Additionally, I included the following code in my core.server.controller.js:
exports.adminIndex = function(req, res) {
res.render('admin.index', {
user: req.user || null
});
};
However, when accessing localhost:3000/admin/, I encounter an error stating: "Cannot find module 'index'".