Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Reinitializing sidebar menu and topbar menu in Angular


Hi,
I have some details with the Demo1 sidebar and top bar menu , when i first access the page they don't work, unless I make a full page reload. Is there a way to reload the Custom Javascript or something else in order to ensure the menu works from de begging?

I'd appreciate your feed back


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (6)


Sorry for the delay. Glad it worked.

Thanks


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.

It worked!! Thank you very much for your help, you are awesome!



Hi Eduardo,

So you are using the JS files from HTML then? core/html/src/js/components/menu.js
For this case, could you please try to reinitialize using this class when the Angular view is mounted?


KTMenu.createInstances();


Thanks



By the way. Every thing was workin normally until I implemented CanActivate from @angular/router. This caused this issue. Thanks in advance again.



I'm using my own custom Angular with HTML Metronic. Thanks in advance for your kind help



Hi,

Sorry for the delay. May I know if you are using the Metronic Angular app? Or your own custom Angular application with HTML Metronic?

If you are using Metronic Angular, the plugin has a reinitialization function. It's in
/angular/demo1/src/app/_metronic/layout/components/scripts-init/scripts-init.component.ts file


Thanks


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(