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

Metronic 8 for Angular : Change Detection


Dear Support Teams,

Does metronic effect changes detection in angular. Coz i found out, when loading/ initiate a page my app does not detect any changes. Unless i type something on input, then it will detect a changes.

My scenario is, when loading a page, i will call an api to list all the result. At first, there is no result displayed in my table. But after i type in any input field , then the result will be shown.

Another thing is, does metronic template come with calendar that can be used with angular. or do i need to install third party library for that eg. ngx-tempusdominus-bootstrap.


Thanks for response


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


Hi Cheyo,

In order to ensure that changes are detected and applied to your UI, you may need to manually trigger change detection in your component.

One way to do this is by injecting the ChangeDetectorRef service into your component, and calling its detectChanges() method after your API call has completed and you have received the results. This will tell Angular to check for any changes and update your UI accordingly.

For example, you could add the following code to your component:


import { Component, OnInit, ChangeDetectorRef } from "@angular/core";

@Component({
// ...
})
export class MyComponent implements OnInit {

results: any[];

constructor(private cdr: ChangeDetectorRef) {}

ngOnInit() {
// Call your API to get the results
this.apiService.getResults().subscribe((results) => {
this.results = results;

// Manually trigger change detection to update the UI
this.cdr.detectChanges();
});
}

}


This should ensure that your UI is updated with the results from your API call, even when the component is first loaded.

The Metronic template provides some basic UI components, but it does not include a calendar component that can be used with Angular out of the box. If you need a calendar component, you can either develop your own custom component or use a third-party library such as ngx-tempusdominus-bootstrap.

To use ngx-tempusdominus-bootstrap, you will need to install it in your project and import it into your Angular module. You can find the installation instructions and documentation on the ngx-tempusdominus-bootstrap GitHub page or its official website. Once you have installed the library, you can use its calendar component in your project.

Thanks


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

React Dev Vacancy

KeenThemes is looking for a Junior React or Vue developer to build awesome apps.
Apply