Medium. Layout, server or Angular layout.

I am developing a mean.js. application I have an administration topic that I am trying to integrate with an existing application.

My question

  • Can we have multiple server layouts? If the logged-in user is a regular user, use layout-1 if the user uses administrator layout-2.
  • If we cannot have multiple server layouts (I suppose this is not possible). Is there a way to detect a params or scope variable in an Angular Client application and dynamically load a partial portion of the main layout.

Say I have an Index.html file, if the proposed route is Dashboard, I just replace the pageview section (Ruby on Rails developers will find out about this)

UPDATE 1 : I created 2 files with my Admin Index and Layout pointers.

admin.index.server.view.html 

and

 admin.layout.server.view.html 

I also added the following code to my core.server.routes.js file

 module.exports = function(app) { // Root routing var core = require('../../app/controllers/core'); app.route('/').get(core.index); app.route('/admin/').get(core.adminIndex); }; 

I also added the following code to my core.server.controller.js file

 exports.adminIndex = function(req, res) { res.render('admin.index', { user: req.user || null }); }; 

and when I am in localhost: 3000 / admin / I get Error: I can not find the module 'index'

+6
source share
1 answer

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.

Also change this line in core.server.controller.js ; res.render('admin.index', {

to that; res.render('admin-index', {

0
source

Source: https://habr.com/ru/post/980161/


All Articles