Mean.js isPublic menu not working

In the mean.js application, I wanted to display menu items on the top navigation bar when the user was subscribed and also discharged. Menu items are displayed when a user logs in, but this does not happen when a user logs out.

An average .js docs value sets the isPublic property to true to display menu items on the navigation bar when a user logs out; but it does not work. Here is the code:

Menus.addMenuItem ('topbar', 'Talks', 'talk', 'dropdown', '/ talk (/ create)?', True); Menus.addSubMenuItem ("top panel", "negotiations", "correspondence", "negotiations"); Menus.addSubMenuItem (“top bar”, “negotiations”, “new conversation”, “negotiations / creation”);

The solutions I was looking at all suggest setting the isPublic property to true, but there seems to be too much confusion on this issue. Anyone with the answers?

+6
source share
1 answer

If you look at menus.client.services.js in the core mean.js module, the last line will look like this: this.addMenu('topbar'); . If you change it to this.addMenu('topbar', true); . You will see all the menu items displayed on the top panel when you are not logged in. Then you can add your menu item, as in your example, or without true , since it inherits it from the parameter that has just been changed:

 Menus.addMenuItem('topbar', 'Talks', 'talks', 'dropdown', '/talks(/create)?'); OR Menus.addMenuItem('topbar', 'Talks', 'talks', 'dropdown', '/talks(/create)?', true); 

Or, as shown below, if you want it to hide when not signed:

 Menus.addMenuItem('topbar', 'Talks', 'talks', 'dropdown', '/talks(/create)?', false); 

Hope this helps.

+8
source

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


All Articles