Metronic Mega Update!Tailwind 4, React 19, Next.js 15, KtUI, ReUI, eCommerce, User Management Apps and more
Explore Update

There is a problem with updating the template content via a variable.


Good day, the problem is that I make a get request, the data comes slowly and they do not have time to load together with the template, and the variable having a new value does not update it in the template. And this happens only in metronic 8 (as a confirmation, a link to the code that shows what I want to implement - https://codesandbox.io/s/naughty-bird-6p5xzz ?file=/src/app/app.service.ts). At the same time, the template updates the data to the new variable data, provided that I click on routelink. How can this be fixed?


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 (2)


If you're having trouble updating the template content via a variable, it might be due to how the variable is being referenced or formatted. Make sure the variable syntax matches the template's expected format. For instance, if you're working with dynamic content, double-check the placeholders. Also, if you’re using Adron Fence PVC fence options in your project, ensure the variable correctly pulls the desired specifications to display accurate fence details.



Hi,
Looks like it's the cause of the ChangeDetection strategy.
Try to follow the article: https://www.digitalocean.com/community/tutorials/angular-change-detection-strategy.
You also have to trigger this.cd.detectChanges(); after you are getting/updating data.

Regards,
Keenthemes support


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  :(