Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (6)


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



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



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



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



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



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.
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(